2021-08-22 01:51:37 +02:00
|
|
|
#ifndef LOG_H
|
|
|
|
#define LOG_H
|
2021-08-22 03:26:09 +02:00
|
|
|
|
|
|
|
/**
|
2021-08-29 23:46:24 +02:00
|
|
|
* \brief Log types
|
2021-08-22 03:26:09 +02:00
|
|
|
*/
|
2021-08-29 23:46:24 +02:00
|
|
|
typedef enum {
|
2021-08-31 12:18:39 +02:00
|
|
|
fatal = 1 << 0,
|
|
|
|
error = 1 << 1,
|
|
|
|
warning = 1 << 2,
|
|
|
|
info = 1 << 3,
|
|
|
|
debug = 1 << 4,
|
|
|
|
link_lock_debug = 1 << 5,
|
|
|
|
network_lock_debug = 1 << 6,
|
|
|
|
cache_lock_debug = 1 << 7,
|
2021-09-04 13:40:37 +02:00
|
|
|
memcache_debug = 1 << 8,
|
2021-09-04 04:00:25 +02:00
|
|
|
libcurl_debug = 1 << 9,
|
2021-08-29 23:46:24 +02:00
|
|
|
} LogType;
|
2021-08-22 03:26:09 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief The default log level
|
|
|
|
*/
|
2021-09-04 04:15:26 +02:00
|
|
|
#define DEFAULT_LOG_LEVEL fatal | error | warning | info
|
2021-08-22 01:51:37 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Get the log level from the environment.
|
|
|
|
*/
|
2021-08-22 03:26:09 +02:00
|
|
|
int log_level_init();
|
|
|
|
|
2021-08-22 01:51:37 +02:00
|
|
|
/**
|
2021-08-29 15:07:22 +02:00
|
|
|
* \brief Log printf
|
2021-08-22 01:51:37 +02:00
|
|
|
* \details This is for printing nice log messages
|
|
|
|
*/
|
2021-08-30 03:50:03 +02:00
|
|
|
void log_printf(LogType type, const char *file, const char *func, int line,
|
|
|
|
const char *format, ...);
|
2021-08-22 01:51:37 +02:00
|
|
|
|
|
|
|
/**
|
2021-08-29 15:07:22 +02:00
|
|
|
* \brief Log type printf
|
2021-08-22 01:51:37 +02:00
|
|
|
* \details This macro automatically prints out the filename and line number
|
|
|
|
*/
|
2021-08-22 03:26:09 +02:00
|
|
|
#define lprintf(type, ...) \
|
2021-08-30 03:50:03 +02:00
|
|
|
log_printf(type, __FILE__, __func__, __LINE__, __VA_ARGS__);
|
2021-08-31 12:15:00 +02:00
|
|
|
#endif
|
2021-08-31 15:00:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Print the version information for HTTPDirFS
|
|
|
|
*/
|
2021-08-31 19:49:49 +02:00
|
|
|
void print_version();
|