add function log_try_init

pull/37/head
YuQing 2018-10-26 15:07:55 +08:00
parent 350f923710
commit f64a00c0f2
1 changed files with 13 additions and 0 deletions

View File

@ -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
*/