Skip to content

Commit

Permalink
add dedicated log level for device (closes #1280)
Browse files Browse the repository at this point in the history
  • Loading branch information
john30 committed Oct 1, 2024
1 parent 85855ea commit 1a8de22
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ebusd/main_args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ static const argDef argDefs[] = {
PACKAGE_LOGFILE "]"},
{"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]"},
{"logareas", O_LOGARE, "AREAS", 0, "Only write log for matching AREA(S): main|network|bus|update|other"
"|all [all]"},
{"logareas", O_LOGARE, "AREAS", 0, "Only write log for matching AREA(S): main|network|bus|device|update"
"|other|all [all]"},
{"loglevel", O_LOGLEV, "LEVEL", 0, "Only write log up to LEVEL: error|notice|info|debug"
" [notice]"},

Expand Down
4 changes: 2 additions & 2 deletions src/lib/ebus/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ void ProtocolHandler::notifyDeviceData(const symbol_t* data, size_t len, bool re

void ProtocolHandler::notifyDeviceStatus(bool error, const char* message) {
if (error) {
logError(lf_bus, "device status: %s", message);
logError(lf_device, message);
} else {
logNotice(lf_bus, "device status: %s", message);
logNotice(lf_device, message);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib/utils/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static const char *s_facilityNames[] = {
"main",
"network",
"bus",
"device",
"update",
"other",
"all",
Expand Down Expand Up @@ -68,7 +69,7 @@ static const int s_syslogLevels[] = {
#endif

/** 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. */
static FILE* s_logFile = stdout;
Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum LogFacility {
lf_main = 0, //!< main loop
lf_network, //!< network related
lf_bus, //!< eBUS related
lf_device, //!< device related
lf_update, //!< updates found while listening to the bus
lf_other, //!< all other log facilities
lf_COUNT = 5 //!< number of available log facilities and flag for setting all
Expand Down

0 comments on commit 1a8de22

Please sign in to comment.