logging: support context-specific severity

Allow messages to have severity set to INFO or DEBUG depending on the
context in which they are made to allow logging important changes made
from chronyc or sourcefile, but not spam the system log if those changes
are normally expected (e.g. specified in the config).
This commit is contained in:
Miroslav Lichvar
2022-11-15 15:05:36 +01:00
parent 7b97668319
commit b328c8c348
4 changed files with 51 additions and 0 deletions

View File

@@ -1515,6 +1515,8 @@ read_from_cmd_socket(int sock_fd, int event, void *anything)
}
if (allowed) {
LOG_SetContext(LOGC_Command);
switch(rx_command) {
case REQ_NULL:
/* Do nothing */
@@ -1762,6 +1764,8 @@ read_from_cmd_socket(int sock_fd, int event, void *anything)
tx_message.status = htons(STT_FAILED);
break;
}
LOG_UnsetContext(LOGC_Command);
} else {
tx_message.status = htons(STT_UNAUTH);
}