add log level check
This commit is contained in:
+19
-15
@@ -28,25 +28,29 @@
|
||||
|
||||
#define WEBCC_LOG_FILE_NAME "webcc.log"
|
||||
|
||||
namespace webcc {
|
||||
namespace webcc
|
||||
{
|
||||
|
||||
enum LogMode {
|
||||
LOG_FILE = 1, // Log to file.
|
||||
LOG_CONSOLE = 2, // Log to console.
|
||||
LOG_FLUSH = 4, // Flush on each log.
|
||||
LOG_OVERWRITE = 8, // Overwrite any existing log file.
|
||||
};
|
||||
enum LogMode
|
||||
{
|
||||
LOG_FILE = 1, // Log to file.
|
||||
LOG_CONSOLE = 2, // Log to console.
|
||||
LOG_FLUSH = 4, // Flush on each log.
|
||||
LOG_OVERWRITE = 8, // Overwrite any existing log file.
|
||||
};
|
||||
|
||||
// Commonly used modes.
|
||||
const int LOG_CONSOLE_FILE_APPEND = LOG_CONSOLE | LOG_FILE;
|
||||
const int LOG_CONSOLE_FILE_OVERWRITE = LOG_CONSOLE | LOG_FILE | LOG_OVERWRITE;
|
||||
const int LOG_FILE_OVERWRITE = LOG_FILE | LOG_OVERWRITE;
|
||||
// Commonly used modes.
|
||||
const int LOG_CONSOLE_FILE_APPEND = LOG_CONSOLE | LOG_FILE;
|
||||
const int LOG_CONSOLE_FILE_OVERWRITE = LOG_CONSOLE | LOG_FILE | LOG_OVERWRITE;
|
||||
const int LOG_FILE_OVERWRITE = LOG_FILE | LOG_OVERWRITE;
|
||||
|
||||
// Initialize logger.
|
||||
// If |dir| is empty, log file will be generated in current directory.
|
||||
void LogInit(const fs::path& dir, int modes);
|
||||
// Initialize logger.
|
||||
// If |dir| is empty, log file will be generated in current directory.
|
||||
void LogInit(const fs::path& dir, int modes);
|
||||
|
||||
void Log(int level, const char* file, int line, const char* format, ...);
|
||||
void LogInit(const fs::path& dir, int modes, int log_level);
|
||||
|
||||
void Log(int level, const char* file, int line, const char* format, ...);
|
||||
|
||||
} // namespace webcc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user