fix: logger
This commit is contained in:
parent
61e025343d
commit
db3bcaf7d1
28 changed files with 200 additions and 180 deletions
helpers
|
@ -30,6 +30,41 @@ helper_load_config(IniDispatch *disp, void *config_void)
|
|||
strcpy(config->database, disp->value);
|
||||
return 0;
|
||||
}
|
||||
if(CONFINI_IS_KEY("controller", "log-level"))
|
||||
{
|
||||
if(strcasecmp(disp->value, "trace") == 0)
|
||||
{
|
||||
config->log_level = LOG_LEVEL_TRACE;
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(disp->value, "debug") == 0)
|
||||
{
|
||||
config->log_level = LOG_LEVEL_DEBUG;
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(disp->value, "info") == 0)
|
||||
{
|
||||
config->log_level = LOG_LEVEL_INFO;
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(disp->value, "warn") == 0)
|
||||
{
|
||||
config->log_level = LOG_LEVEL_WARN;
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(disp->value, "error") == 0)
|
||||
{
|
||||
config->log_level = LOG_LEVEL_ERROR;
|
||||
return 0;
|
||||
}
|
||||
if(strcasecmp(disp->value, "fatal") == 0)
|
||||
{
|
||||
config->log_level = LOG_LEVEL_FATAL;
|
||||
return 0;
|
||||
}
|
||||
LOG_WARN("invalid log-level '%s'\n", disp->value);
|
||||
return 0;
|
||||
}
|
||||
if(CONFINI_IS_KEY("controller", "discovery-port"))
|
||||
{
|
||||
config->discovery_port = atoi(disp->value);
|
||||
|
@ -43,7 +78,7 @@ helper_load_config(IniDispatch *disp, void *config_void)
|
|||
{
|
||||
config->relay_configs[i].driver= RELAY_DRIVER_NONE;
|
||||
}
|
||||
LOG_TRACE("config relay-count set to %u", config->relay_count);
|
||||
LOG_TRACE("config relay-count set to %u\n", config->relay_count);
|
||||
return 0;
|
||||
}
|
||||
for(uint8_t i = 0; i < config->relay_count; ++i)
|
||||
|
@ -71,7 +106,7 @@ helper_load_config(IniDispatch *disp, void *config_void)
|
|||
config->relay_configs[i].driver = RELAY_DRIVER_PIFACE;
|
||||
return 0;
|
||||
}
|
||||
LOG_WARN("invalid driver '%s' in section '%s'", disp->value, relay_section_name);
|
||||
LOG_WARN("invalid driver '%s' in section '%s'\n", disp->value, relay_section_name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue