Always log to STDERR, even for debug, info, etc.
Rationale: * Logging to STDERR enables separation of processable output (e.g., `--version` or `--help`) and ephemeral status/error messages. * A single file descriptor for all log messages makes it easier for users to capture all log messages. * Consistency: it's what most utilities do.
This commit is contained in:
parent
d6693e0175
commit
bcd57b486b
2 changed files with 11 additions and 9 deletions
|
@ -13,6 +13,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master).
|
||||||
* The default web service for `--webv4` and `--webv6` has changed from Google
|
* The default web service for `--webv4` and `--webv6` has changed from Google
|
||||||
Domains (which is shutting down) to ipify.
|
Domains (which is shutting down) to ipify.
|
||||||
[5b104ad1](https://github.com/ddclient/ddclient/commit/5b104ad116c023c3760129cab6e141f04f72b406)
|
[5b104ad1](https://github.com/ddclient/ddclient/commit/5b104ad116c023c3760129cab6e141f04f72b406)
|
||||||
|
* All log messages are now written to STDERR, not a mix of STDOUT and STDERR.
|
||||||
|
[#676](https://github.com/ddclient/ddclient/pull/676)
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
||||||
|
|
18
ddclient.in
18
ddclient.in
|
@ -2420,15 +2420,15 @@ sub logmsg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sub msg { logmsg(fh => *STDOUT, sprintf(shift, @_)); }
|
sub msg { logmsg( sprintf(shift, @_)); }
|
||||||
sub verbose { logmsg(fh => *STDOUT, email => 1, pfx => pop, sprintf(shift, @_)) if opt('verbose'); }
|
sub verbose { logmsg(email => 1, pfx => pop, sprintf(shift, @_)) if opt('verbose'); }
|
||||||
sub info { logmsg(fh => *STDOUT, email => 1, pfx => 'INFO:', sprintf(shift, @_)) if opt('verbose'); }
|
sub info { logmsg(email => 1, pfx => 'INFO:', sprintf(shift, @_)) if opt('verbose'); }
|
||||||
sub debug { logmsg(fh => *STDOUT, pfx => 'DEBUG:', sprintf(shift, @_)) if opt('debug'); }
|
sub debug { logmsg( pfx => 'DEBUG:', sprintf(shift, @_)) if opt('debug'); }
|
||||||
sub debug2 { logmsg(fh => *STDOUT, pfx => 'DEBUG:', sprintf(shift, @_)) if opt('debug') && opt('verbose'); }
|
sub debug2 { logmsg( pfx => 'DEBUG:', sprintf(shift, @_)) if opt('debug') && opt('verbose'); }
|
||||||
sub warning { logmsg( email => 1, pfx => 'WARNING:', sprintf(shift, @_)); }
|
sub warning { logmsg(email => 1, pfx => 'WARNING:', sprintf(shift, @_)); }
|
||||||
sub fatal { logmsg( email => 1, pfx => 'FATAL:', sprintf(shift, @_)); sendmail(); exit(1); }
|
sub fatal { logmsg(email => 1, pfx => 'FATAL:', sprintf(shift, @_)); sendmail(); exit(1); }
|
||||||
sub success { logmsg(fh => *STDOUT, email => 1, pfx => 'SUCCESS:', sprintf(shift, @_)); }
|
sub success { logmsg(email => 1, pfx => 'SUCCESS:', sprintf(shift, @_)); }
|
||||||
sub failed { logmsg( email => 1, pfx => 'FAILED:', sprintf(shift, @_)); $result = 'FAILED'; }
|
sub failed { logmsg(email => 1, pfx => 'FAILED:', sprintf(shift, @_)); $result = 'FAILED'; }
|
||||||
sub prettytime { return scalar(localtime(shift)); }
|
sub prettytime { return scalar(localtime(shift)); }
|
||||||
|
|
||||||
sub prettyinterval {
|
sub prettyinterval {
|
||||||
|
|
Loading…
Reference in a new issue