From f64a00c0f2a338057b077e656eff2039ee452c32 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Fri, 26 Oct 2018 15:07:55 +0800 Subject: [PATCH] add function log_try_init --- src/logger.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/logger.h b/src/logger.h index ae7dafb..2ed41db 100644 --- a/src/logger.h +++ b/src/logger.h @@ -115,6 +115,19 @@ extern LogContext g_log_context; */ int log_init(); +/** init function using global log context + * do nothing when already inited + * return: 0 for success, != 0 fail +*/ +static int log_try_init() +{ + if (g_log_context.log_buff != NULL) + { + return 0; + } + return log_init(); +} + /** init function using global log context, take over stderr and stdout * return: 0 for success, != 0 fail */ -- GitLab