add log level check

This commit is contained in:
UnknownObject
2022-11-20 15:45:30 +08:00
parent e0f8a4da37
commit 9df50c1310
320 changed files with 237 additions and 205 deletions
+19 -15
View File
@@ -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