feature:根据文件大小分割日志

This commit is contained in:
2024-11-19 21:31:00 +08:00
parent 81cebc7a18
commit de03985fef
11 changed files with 137 additions and 29 deletions

View File

@@ -8,6 +8,9 @@
#include "logging/logging-handler.h"
#include "logging/logging-interceptor.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Logger {
log_level level;
@@ -34,4 +37,8 @@ typedef struct Logging {
Logging *newLogging();
#ifdef __cplusplus
}
#endif
#endif // __LOGGING_H__

View File

@@ -1,6 +1,10 @@
#ifndef __LOGGING_CORE_H__
#define __LOGGING_CORE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
LOG_FATAL,
LOG_ERROR,
@@ -14,4 +18,8 @@ typedef enum {
L_OK,
} log_status;
#ifdef __cplusplus
}
#endif
#endif // __LOGGING_CORE_H__

View File

@@ -3,6 +3,10 @@
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct log_Handler {
void *stream;
bool apply_color;
@@ -10,7 +14,11 @@ typedef struct log_Handler {
void (*output)(struct log_Handler *handler, const char *message);
} log_Handler;
log_Handler *loggingFileHandler(const char *name);
log_Handler *loggingFileHandler(const char *name, unsigned int max_size);
log_Handler *loggingConsoleHandler();
#ifdef __cplusplus
}
#endif
#endif //__LOGGING_HANDLER_H__

View File

@@ -4,6 +4,10 @@
#include "logging-core.h"
#include "logging-handler.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct log_Interceptor {
log_level level;
log_Handler *handler;
@@ -23,4 +27,8 @@ log_Interceptor *loggingSubStringInterceptor(char *keywords[],
log_level level,
log_Handler *handler);
#ifdef __cplusplus
}
#endif
#endif // __LOGGING_INTERCEPTOR_H__