diff --git a/src/logger.h b/src/logger.h index ae7dafbda46dacf4e9260c22c5c0a469bfd711d4..2ed41db43f953fb590f9fb883987eef8d572dc13 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 */