瀏覽代碼

feat: 新增LogSystemInfo打印输出

SongZihuan 3 年之前
父節點
當前提交
4995cbfac5
共有 3 個文件被更改,包括 6 次插入0 次删除
  1. 1 0
      include/tool/log.h
  2. 4 0
      src/tool/log.c
  3. 1 0
      test/src/logger.c

+ 1 - 0
include/tool/log.h

@@ -31,6 +31,7 @@ struct Logger {
 };
 typedef struct Logger Logger;
 
+AFUN_TOOL_EXPORT void printLogSystemInfo(void);
 AFUN_TOOL_EXPORT int initLogSystem(FilePath path, bool asyn);
 AFUN_TOOL_EXPORT int destructLogSystem(void);
 

+ 4 - 0
src/tool/log.c

@@ -76,6 +76,10 @@ static pthread_mutex_t log_factory_mutex = PTHREAD_MUTEX_INITIALIZER;
 static void destructLogSystemAtExit(void *data);
 static void *ansyWritrLog_(void *_);
 
+void printLogSystemInfo(void) {
+    printf("Log system on %p\n", &log_factory);
+}
+
 /*
  * 函数名: initLogSystem
  * 目标: 初始化日志系统

+ 1 - 0
test/src/logger.c

@@ -15,6 +15,7 @@ int main(int argc, char **argv){
             .buf=&main_buf,
     };
 
+    printLogSystemInfo();
     if (!aFunInit(&info)) {
 INIT_ERROR:
         printf_stderr(0, "aFunlang init error.");