Skip to content

Commit

Permalink
Change: Fallback to "*" section for all settings in a log domain
Browse files Browse the repository at this point in the history
Use all log settings from the start section (our default domain) not
only selected ones if the setting is not set in a domain. For example
with the following config
```
[*]
prepend=%t %s %
prepend_time_format=%Y-%m-%d %Hh%M.%S %Z

[foo]
file=-
```

for the "foo" log domain the `prepend_time_format` from the star section
should be used too if it is not set. Before only the `prepend` string
was used.
  • Loading branch information
bjoernricks committed Feb 14, 2025
1 parent 07d405e commit d4ce988
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions base/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,22 @@ gvm_log_func (const char *log_domain, GLogLevelFlags log_level,
if (gvm_logging_domain_get_prepend_string (log_domain_entry))
prepend_format =
gvm_logging_domain_get_prepend_string (log_domain_entry);
time_format =
gvm_logging_domain_get_prepend_time_format (log_domain_entry);
log_file = gvm_logging_domain_get_log_file (log_domain_entry);
if (gvm_logging_domain_get_prepend_time_format (log_domain_entry))
time_format =
gvm_logging_domain_get_prepend_time_format (log_domain_entry);
if (gvm_logging_domain_get_log_file (log_domain_entry))
log_file = gvm_logging_domain_get_log_file (log_domain_entry);
if (gvm_logging_domain_get_default_level (log_domain_entry))
default_level =
*gvm_logging_domain_get_default_level (log_domain_entry);
channel = gvm_logging_domain_get_log_channel (log_domain_entry);
syslog_facility =
gvm_logging_domain_get_syslog_facility (log_domain_entry);
syslog_ident =
gvm_logging_domain_get_syslog_ident (log_domain_entry);
if (gvm_logging_domain_get_log_channel (log_domain_entry))
channel = gvm_logging_domain_get_log_channel (log_domain_entry);
if (gvm_logging_domain_get_syslog_facility (log_domain_entry))
syslog_facility =
gvm_logging_domain_get_syslog_facility (log_domain_entry);
if (gvm_logging_domain_get_syslog_ident (log_domain_entry))
syslog_ident =
gvm_logging_domain_get_syslog_ident (log_domain_entry);
if (gvm_logging_domain_get_prepend_separator (log_domain_entry))
log_separator =
gvm_logging_domain_get_prepend_separator (log_domain_entry);
Expand Down

0 comments on commit d4ce988

Please sign in to comment.