secgateway/Platform/user/ulog/log-sched/log_console.c

36 lines
1.1 KiB
C
Executable File

#include "log_console.h"
#include "log_common.h"
#define LOG_CONF_COSOLE_FILE_NAME "log-console.conf"
#define LOG_REDIRECT_CONSOLE "/dev/console"
static int config_log_console(const log_console_t *conf)
{
if (write_log_conf(conf->level, LOG_CONF_PATH, LOG_CONF_COSOLE_FILE_NAME, LOG_REDIRECT_CONSOLE, conf->module_name) != 0) {
ULOG_ERR(g_log, "configure of log conosle which is written is failure");
return 1;
}
if (modify_authorizing(LOG_REDIRECT_CONSOLE) != 0) {
ULOG_ERR(g_log, "Modifying authorizing of %s is failure", LOG_REDIRECT_CONSOLE);
return 1;
}
return 0;
}
void rpc_conf_log_console(rpc_conn *conn, pointer input, int input_len, pointer data)
{
u32 need_len = sizeof(log_console_t);
if (input_len < need_len) {
ULOG_WARNING(g_log,
"The input paramter of rpc log console is needed length of %u, but the actual length is %u",
need_len, input_len);
return;
}
config_log_console((const log_console_t *)input);
}