mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-25 18:06:29 +00:00
15 lines
396 B
Rust
15 lines
396 B
Rust
|
|
use crate::cmd_args::{Args, LogFormat};
|
||
|
|
use tracing_subscriber;
|
||
|
|
|
||
|
|
pub fn init(args: &Args) {
|
||
|
|
let trace_sub = tracing_subscriber::fmt()
|
||
|
|
.with_max_level(args.log_level)
|
||
|
|
.with_ansi(!args.no_color);
|
||
|
|
|
||
|
|
match args.log_format {
|
||
|
|
LogFormat::Structured => trace_sub.json().init(),
|
||
|
|
LogFormat::Debug => trace_sub.pretty().init(),
|
||
|
|
_ => trace_sub.init(),
|
||
|
|
};
|
||
|
|
}
|