-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`LoggerHandle::adapt_duplication_to_stderr` and `LoggerHandle::adapt_duplication_to_stdout` - (realizes issue #142). And: - Extend docu on providing custom format. - Use rust-script instead of cargo-script for qualification scripts. - Update dependencies.
- Loading branch information
Showing
14 changed files
with
165 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "flexi_logger" | ||
version = "0.25.5" | ||
version = "0.25.6" | ||
authors = ["emabee <[email protected]>"] | ||
categories = ["development-tools::debugging"] | ||
description = """ | ||
|
@@ -41,7 +41,7 @@ trc = ["async", "specfile", "tracing", "tracing-subscriber"] | |
|
||
[dependencies] | ||
is-terminal = { version = "0.4", optional = true } | ||
nu-ansi-term = { version = "0.47", optional = true } | ||
nu-ansi-term = { version = "0.49", optional = true } | ||
chrono = { version = "0.4.22", default-features = false, features = ["clock"] } | ||
crossbeam-channel = { version = "0.5", optional = true } | ||
crossbeam-queue = { version = "0.3", optional = true } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use flexi_logger::{DeferredNow, FlexiLoggerError, Logger}; | ||
use log::*; | ||
use std::sync::atomic::{AtomicU32, Ordering}; | ||
|
||
// Produces | ||
// 1 INFO [entry_numbers] first | ||
// 2 WARN [entry_numbers] second | ||
// 3 ERROR [entry_numbers] third | ||
fn main() -> Result<(), FlexiLoggerError> { | ||
Logger::try_with_str("info")?.format(my_format).start()?; | ||
|
||
info!("first"); | ||
warn!("second"); | ||
error!("third"); | ||
Ok(()) | ||
} | ||
|
||
pub fn my_format( | ||
w: &mut dyn std::io::Write, | ||
_now: &mut DeferredNow, | ||
record: &Record, | ||
) -> Result<(), std::io::Error> { | ||
static LINE: AtomicU32 = AtomicU32::new(1); | ||
write!( | ||
w, | ||
"{:>6} {} [{}] {}", | ||
LINE.fetch_add(1, Ordering::Relaxed), | ||
record.level(), | ||
record.module_path().unwrap_or("<unnamed>"), | ||
record.args() | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env rust-script | ||
//! ```cargo | ||
//! [dependencies] | ||
//! yansi = "0.5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env rust-script | ||
//! ```cargo | ||
//! [dependencies] | ||
//! yansi = "0.5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters