httpdirfs/src/log.h

49 lines
1010 B
C
Raw Permalink Normal View History

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,
2024-05-05 03:00:46 +02:00
debug = 1 << 4,
2021-08-31 12:18:39 +02:00
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
*/
2024-05-05 03:00:46 +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
/**
* \brief Log printf
2021-08-22 01:51:37 +02:00
* \details This is for printing nice log messages
*/
void log_printf(LogType type, const char *file, const char *func, int line,
const char *format, ...);
2021-08-22 01:51:37 +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, ...) \
log_printf(type, __FILE__, __func__, __LINE__, __VA_ARGS__)
2021-08-31 15:00:47 +02:00
/**
* \brief Print the version information for HTTPDirFS
*/
void print_version();
2024-05-03 08:33:41 +02:00
#endif