core/log: Don't use #defines for log levels
This commit is contained in:
parent
94f94c0f0d
commit
13381d0202
@ -11,6 +11,14 @@
|
|||||||
|
|
||||||
pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
const int LOG_FATAL = 0;
|
||||||
|
const int LOG_ERROR = 1;
|
||||||
|
const int LOG_WARNING = 2;
|
||||||
|
const int LOG_INFO = 3;
|
||||||
|
const int LOG_VERBOSE = 4;
|
||||||
|
const int LOG_DEBUG = 5;
|
||||||
|
const int LOG_TRACE = 6;
|
||||||
|
|
||||||
bool line_begin = true;
|
bool line_begin = true;
|
||||||
int current_level = 0;
|
int current_level = 0;
|
||||||
//int max_level = LOG_DEBUG;
|
//int max_level = LOG_DEBUG;
|
||||||
|
@ -2,19 +2,20 @@
|
|||||||
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
|
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
extern const int LOG_FATAL;
|
||||||
|
extern const int LOG_ERROR;
|
||||||
|
extern const int LOG_WARNING;
|
||||||
|
extern const int LOG_INFO;
|
||||||
|
extern const int LOG_VERBOSE;
|
||||||
|
extern const int LOG_DEBUG;
|
||||||
|
extern const int LOG_TRACE;
|
||||||
|
|
||||||
void log_set_max_level(int level);
|
void log_set_max_level(int level);
|
||||||
int log_get_max_level();
|
int log_get_max_level();
|
||||||
void log_set_file(const char *path);
|
void log_set_file(const char *path);
|
||||||
void log_close();
|
void log_close();
|
||||||
|
|
||||||
void log_nl();
|
void log_nl();
|
||||||
#define LOG_FATAL 0
|
|
||||||
#define LOG_ERROR 1
|
|
||||||
#define LOG_WARNING 2
|
|
||||||
#define LOG_INFO 3
|
|
||||||
#define LOG_VERBOSE 4
|
|
||||||
#define LOG_DEBUG 5
|
|
||||||
#define LOG_TRACE 6
|
|
||||||
void log_(int level, const char *sys, const char *fmt, ...)
|
void log_(int level, const char *sys, const char *fmt, ...)
|
||||||
__attribute__((format(printf, 3, 4)));
|
__attribute__((format(printf, 3, 4)));
|
||||||
#define log_f(sys, fmt, ...) log_(LOG_FATAL, sys, fmt, ##__VA_ARGS__)
|
#define log_f(sys, fmt, ...) log_(LOG_FATAL, sys, fmt, ##__VA_ARGS__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user