Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1+ */
0002 /* Copyright (C) 2022, Linaro Ltd - Daniel Lezcano <daniel.lezcano@linaro.org> */
0003 #ifndef __THERMAL_TOOLS_LOG_H
0004 #define __THERMAL_TOOLS_LOG_H
0005 
0006 #include <syslog.h>
0007 
0008 #ifndef __maybe_unused
0009 #define __maybe_unused      __attribute__((__unused__))
0010 #endif
0011 
0012 #define TO_SYSLOG 0x1
0013 #define TO_STDOUT 0x2
0014 #define TO_STDERR 0x4
0015 
0016 extern void logit(int level, const char *format, ...);
0017 
0018 #define DEBUG(fmt, ...)     logit(LOG_DEBUG, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
0019 #define INFO(fmt, ...)      logit(LOG_INFO, fmt, ##__VA_ARGS__)
0020 #define NOTICE(fmt, ...)    logit(LOG_NOTICE, fmt, ##__VA_ARGS__)
0021 #define WARN(fmt, ...)      logit(LOG_WARNING, fmt, ##__VA_ARGS__)
0022 #define ERROR(fmt, ...)     logit(LOG_ERR, fmt, ##__VA_ARGS__)
0023 #define CRITICAL(fmt, ...)  logit(LOG_CRIT, fmt, ##__VA_ARGS__)
0024 #define ALERT(fmt, ...)     logit(LOG_ALERT, fmt, ##__VA_ARGS__)
0025 #define EMERG(fmt, ...)     logit(LOG_EMERG, fmt, ##__VA_ARGS__)
0026 
0027 int log_init(int level, const char *ident, int options);
0028 int log_str2level(const char *lvl);
0029 void log_exit(void);
0030 
0031 #endif