mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-18 17:26:19 +00:00
Colorful logging in examples
This commit is contained in:
committed by
Dirkjan Ochtman
parent
f112e25e53
commit
747d5a263b
+3
-1
@@ -33,11 +33,13 @@ struct Opt {
|
||||
fn main() {
|
||||
let opt = Opt::from_args();
|
||||
let code = {
|
||||
let decorator = slog_term::PlainSyncDecorator::new(std::io::stderr());
|
||||
let decorator = slog_term::TermDecorator::new().stderr().build();
|
||||
let drain = slog_term::FullFormat::new(decorator)
|
||||
.use_original_order()
|
||||
.build()
|
||||
.fuse();
|
||||
// We use a mutex-protected drain for simplicity; this tool is single-threaded anyway.
|
||||
let drain = std::sync::Mutex::new(drain).fuse();
|
||||
if let Err(e) = run(Logger::root(drain, o!()), opt) {
|
||||
eprintln!("ERROR: {}", e);
|
||||
1
|
||||
|
||||
@@ -46,11 +46,13 @@ struct Opt {
|
||||
fn main() {
|
||||
let opt = Opt::from_args();
|
||||
let code = {
|
||||
let decorator = slog_term::PlainSyncDecorator::new(std::io::stderr());
|
||||
let decorator = slog_term::TermDecorator::new().stderr().build();
|
||||
let drain = slog_term::FullFormat::new(decorator)
|
||||
.use_original_order()
|
||||
.build()
|
||||
.fuse();
|
||||
// We use a mutex-protected drain for simplicity; this example is single-threaded anyway.
|
||||
let drain = std::sync::Mutex::new(drain).fuse();
|
||||
if let Err(e) = run(Logger::root(drain, o!()), opt) {
|
||||
eprintln!("ERROR: {}", e);
|
||||
1
|
||||
|
||||
@@ -69,11 +69,12 @@ struct Opt {
|
||||
fn main() {
|
||||
let opt = Opt::from_args();
|
||||
let code = {
|
||||
let decorator = slog_term::PlainSyncDecorator::new(std::io::stderr());
|
||||
let decorator = slog_term::TermDecorator::new().stderr().build();
|
||||
let drain = slog_term::FullFormat::new(decorator)
|
||||
.use_original_order()
|
||||
.build()
|
||||
.fuse();
|
||||
.build();
|
||||
// We use a mutex-protected drain for simplicity; this example is single-threaded anyway.
|
||||
let drain = std::sync::Mutex::new(drain).fuse();
|
||||
if let Err(e) = run(Logger::root(drain, o!()), opt) {
|
||||
eprintln!("ERROR: {}", e.pretty());
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user