summaryrefslogtreecommitdiff
path: root/common/src/log.cpp
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2023-08-09 18:47:16 +0800
committerluwenpeng <[email protected]>2023-08-10 18:31:38 +0800
commite34aa3f5e23d7fa0b95944269c499d5c1e7c23aa (patch)
treeaf0565991e01741c850d9479850fc58df6f9b509 /common/src/log.cpp
parent1063574ca0d3fea91f26b8a6bd76a2d021efd822 (diff)
TSG-16531 PacketAdapter适配容器环境,使用mrzcpd收包,通过RAW Socket注RST包v2.0.0-20230810
Diffstat (limited to 'common/src/log.cpp')
-rw-r--r--common/src/log.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/common/src/log.cpp b/common/src/log.cpp
new file mode 100644
index 0000000..5a6a7cf
--- /dev/null
+++ b/common/src/log.cpp
@@ -0,0 +1,33 @@
+#include "log.h"
+
+void *default_logger = NULL;
+
+// return 0 : success
+// return -1 : error
+int LOG_INIT(const char *profile)
+{
+ if (0 != MESA_handle_runtime_log_creation(profile))
+ {
+ fprintf(stderr, "FATAL: unable to create runtime logger\n");
+ return -1;
+ }
+
+ default_logger = MESA_create_runtime_log_handle("packet_adapter", RLOG_LV_DEBUG);
+ if (default_logger == NULL)
+ {
+ fprintf(stderr, "FATAL: unable to create log handle\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+void LOG_CLOSE(void)
+{
+ MESA_handle_runtime_log_destruction();
+}
+
+void LOG_RELOAD(void)
+{
+ MESA_handle_runtime_log_reconstruction(NULL);
+}