add dedicated log level for device (closes #1280)
This commit is contained in:
@@ -203,8 +203,8 @@ static const argDef argDefs[] = {
|
|||||||
PACKAGE_LOGFILE "]"},
|
PACKAGE_LOGFILE "]"},
|
||||||
{"log", O_LOG, "AREAS:LEVEL", 0, "Only write log for matching AREA(S) up to LEVEL"
|
{"log", O_LOG, "AREAS:LEVEL", 0, "Only write log for matching AREA(S) up to LEVEL"
|
||||||
" (alternative to --logareas/--logevel, may be used multiple times) [all:notice]"},
|
" (alternative to --logareas/--logevel, may be used multiple times) [all:notice]"},
|
||||||
{"logareas", O_LOGARE, "AREAS", 0, "Only write log for matching AREA(S): main|network|bus|update|other"
|
{"logareas", O_LOGARE, "AREAS", 0, "Only write log for matching AREA(S): main|network|bus|device|update"
|
||||||
"|all [all]"},
|
"|other|all [all]"},
|
||||||
{"loglevel", O_LOGLEV, "LEVEL", 0, "Only write log up to LEVEL: error|notice|info|debug"
|
{"loglevel", O_LOGLEV, "LEVEL", 0, "Only write log up to LEVEL: error|notice|info|debug"
|
||||||
" [notice]"},
|
" [notice]"},
|
||||||
|
|
||||||
|
|||||||
@@ -184,9 +184,9 @@ void ProtocolHandler::notifyDeviceData(const symbol_t* data, size_t len, bool re
|
|||||||
|
|
||||||
void ProtocolHandler::notifyDeviceStatus(bool error, const char* message) {
|
void ProtocolHandler::notifyDeviceStatus(bool error, const char* message) {
|
||||||
if (error) {
|
if (error) {
|
||||||
logError(lf_bus, "device status: %s", message);
|
logError(lf_device, message);
|
||||||
} else {
|
} else {
|
||||||
logNotice(lf_bus, "device status: %s", message);
|
logNotice(lf_device, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ static const char *s_facilityNames[] = {
|
|||||||
"main",
|
"main",
|
||||||
"network",
|
"network",
|
||||||
"bus",
|
"bus",
|
||||||
|
"device",
|
||||||
"update",
|
"update",
|
||||||
"other",
|
"other",
|
||||||
"all",
|
"all",
|
||||||
@@ -68,7 +69,7 @@ static const int s_syslogLevels[] = {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** the current log level by log facility. */
|
/** the current log level by log facility. */
|
||||||
static LogLevel s_facilityLogLevel[] = { ll_notice, ll_notice, ll_notice, ll_notice, ll_notice, };
|
static LogLevel s_facilityLogLevel[] = { ll_notice, ll_notice, ll_notice, ll_notice, ll_notice, ll_notice, };
|
||||||
|
|
||||||
/** the current log FILE, or nullptr if closed or syslog is used. */
|
/** the current log FILE, or nullptr if closed or syslog is used. */
|
||||||
static FILE* s_logFile = stdout;
|
static FILE* s_logFile = stdout;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ enum LogFacility {
|
|||||||
lf_main = 0, //!< main loop
|
lf_main = 0, //!< main loop
|
||||||
lf_network, //!< network related
|
lf_network, //!< network related
|
||||||
lf_bus, //!< eBUS related
|
lf_bus, //!< eBUS related
|
||||||
|
lf_device, //!< device related
|
||||||
lf_update, //!< updates found while listening to the bus
|
lf_update, //!< updates found while listening to the bus
|
||||||
lf_other, //!< all other log facilities
|
lf_other, //!< all other log facilities
|
||||||
lf_COUNT = 5 //!< number of available log facilities and flag for setting all
|
lf_COUNT = 5 //!< number of available log facilities and flag for setting all
|
||||||
|
|||||||
Reference in New Issue
Block a user