fix[os_log]: Modify default log option for linux

LOG_PERROR: Directs output to stderr stream.
LOG_CONS: Fallback to /dev/console only when syslogd is unavailable.

The syslogd maybe unavailable in linux os.

Signed-off-by: Yandong Lin <yandong.lin@rock-chips.com>
Change-Id: Iae95f7df9e6ed3f7e8ce15accce6fae5a65f2fef
This commit is contained in:
Yandong Lin
2025-03-05 17:58:55 +08:00
parent ad26e20d69
commit 4ed4105a3c

View File

@@ -39,13 +39,18 @@ static SyslogWrapper syslog_wrapper;
SyslogWrapper::SyslogWrapper()
{
int option = LOG_PID | LOG_CONS;
RK_U32 syslog_perror = 0;
int option = LOG_PID;
RK_U32 syslog_perror = 1;
RK_U32 syslog_cons = 0;
os_get_env_u32("mpp_syslog_perror", &syslog_perror, 0);
os_get_env_u32("mpp_syslog_perror", &syslog_perror, 1);
if (syslog_perror)
option |= LOG_PERROR;
os_get_env_u32("mpp_syslog_cons", &syslog_cons, 0);
if (syslog_cons)
option |= LOG_CONS;
openlog("mpp", option, LOG_USER);
}