[posix-host] set logging level early (#4408)

This commit sets logging level just after parsing command line
arguments so that dying messages during initialization can be printed.
This commit is contained in:
Yakun Xu
2019-12-16 12:35:55 -08:00
committed by Jonathan Hui
parent c3a3a0c424
commit a1f7e43452
+1 -3
View File
@@ -193,10 +193,9 @@ static otInstance *InitInstance(int aArgCount, char *aArgVector[])
ParseArg(aArgCount, aArgVector, &config);
#if OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED
openlog(aArgVector[0], LOG_PID | (config.mIsVerbose ? LOG_PERROR : 0), LOG_DAEMON);
setlogmask(setlogmask(0) & LOG_UPTO(LOG_DEBUG));
#endif
otLoggingSetLevel(config.mLogLevel);
instance = otSysInit(&config.mPlatformConfig);
@@ -210,7 +209,6 @@ static otInstance *InitInstance(int aArgCount, char *aArgVector[])
exit(OT_EXIT_SUCCESS);
}
otLoggingSetLevel(config.mLogLevel);
return instance;
}