Add option to redirect logging to stderr. (resolves #154)
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -888,6 +888,15 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub log_thread_ids: bool,
|
||||
|
||||
/// Redirects logging to standard error (stderr). The default is false for
|
||||
/// stdout. For those using our systemd features the redirection to stderr
|
||||
/// occurs as necessary and setting this option should not be required. We
|
||||
/// offer this option for all other users who desire such redirection.
|
||||
///
|
||||
/// default: false
|
||||
#[serde(default)]
|
||||
pub log_to_stderr: bool,
|
||||
|
||||
/// OpenID token expiration/TTL in seconds.
|
||||
///
|
||||
/// These are the OpenID tokens that are primarily used for Matrix account
|
||||
|
||||
@@ -28,13 +28,13 @@ pub struct ConsoleWriter {
|
||||
|
||||
impl ConsoleWriter {
|
||||
#[must_use]
|
||||
pub fn new(_config: &Config) -> Self {
|
||||
pub fn new(config: &Config) -> Self {
|
||||
let journal_stream = get_journal_stream();
|
||||
Self {
|
||||
stdout: io::stdout(),
|
||||
stderr: io::stderr(),
|
||||
_journal_stream: journal_stream.into(),
|
||||
use_stderr: journal_stream.0 != 0,
|
||||
use_stderr: journal_stream.0 != 0 || config.log_to_stderr,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,6 +733,13 @@
|
||||
#
|
||||
#log_thread_ids = false
|
||||
|
||||
# Redirects logging to standard error (stderr). The default is false for
|
||||
# stdout. For those using our systemd features the redirection to stderr
|
||||
# occurs as necessary and setting this option should not be required. We
|
||||
# offer this option for all other users who desire such redirection.
|
||||
#
|
||||
#log_to_stderr = false
|
||||
|
||||
# OpenID token expiration/TTL in seconds.
|
||||
#
|
||||
# These are the OpenID tokens that are primarily used for Matrix account
|
||||
|
||||
Reference in New Issue
Block a user