Fix logging in docker.
Docker by default doesn't have a TTY. The TermLogger doesn't work in that case. If the TermLogger can't be initiated, try the SimpleLogger. See https://github.com/Drakulix/simplelog.rs/issues/30 for a similar case.
This commit is contained in:
parent
f3e48b8507
commit
0224a5dee3
1 changed files with 4 additions and 2 deletions
|
@ -124,8 +124,10 @@ fn daemonize(options: &getopts::Matches) -> Result<()> {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn init_log(log_level: LevelFilter, options: &getopts::Matches) -> Result<()> {
|
fn init_log(log_level: LevelFilter, options: &getopts::Matches) -> Result<()> {
|
||||||
if options.opt_present("f") {
|
if options.opt_present("f") {
|
||||||
if let Err(e) = TermLogger::init(log_level, LOG_CONFIG) {
|
if let Err(_) = TermLogger::init(log_level, LOG_CONFIG) {
|
||||||
bail!("Error starting terminal logger: {}", e);
|
if let Err(e) = SimpleLogger::init(log_level, LOG_CONFIG) {
|
||||||
|
bail!("Error starting terminal logger: {}", e);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if let Err(e) = SimpleLogger::init(log_level, LOG_CONFIG) {
|
if let Err(e) = SimpleLogger::init(log_level, LOG_CONFIG) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue