39 lines
754 B
C
39 lines
754 B
C
#ifndef _OAUTH2LIB_LOG_
|
|
#define _OAUTH2LIB_LOG_
|
|
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
enum LOG_LEVEL {
|
|
LOG_ERR,
|
|
LOG_WARN,
|
|
LOG_INFO,
|
|
LOG_DEBUG,
|
|
LOG_TRACE,
|
|
};
|
|
|
|
struct log_config_s {
|
|
FILE* loc_error;
|
|
FILE* loc_warn;
|
|
FILE* loc_info;
|
|
FILE* loc_debug;
|
|
FILE* loc_trace;
|
|
|
|
bool timestamp;
|
|
};
|
|
|
|
struct logger_s {
|
|
const char* module_name;
|
|
struct log_config_s config;
|
|
};
|
|
|
|
void log_set_default_config(struct log_config_s config);
|
|
struct logger_s log_new(const char* module_name);
|
|
|
|
void log_log(const struct logger_s* logger, enum LOG_LEVEL log_level, const char* fmt, ...);
|
|
|
|
void log_log_ssl_err(const struct logger_s* logger, enum LOG_LEVEL log_level, unsigned long error, const char* message_fmt, ...);
|
|
|
|
#endif //_OAUTH2LIB_LOG_
|