-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this commit adds the tracing-subscriber crate and use its formatters to support multiple log formats. More details in #464 (comment) Signed-off-by: Sebastian Webber <[email protected]>
- Loading branch information
1 parent
7bdb4e5
commit 899dcc7
Showing
6 changed files
with
109 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 +1,27 @@ | ||
use clap::Parser; | ||
use log::LevelFilter; | ||
use clap::{Parser, ValueEnum}; | ||
use tracing::Level; | ||
|
||
/// PgCat: Nextgen PostgreSQL Pooler | ||
#[derive(Parser, Debug)] | ||
#[command(author, version, about, long_about = None)] | ||
pub(crate) struct Args { | ||
pub struct Args { | ||
#[arg(default_value_t = String::from("pgcat.toml"), env)] | ||
pub config_file: String, | ||
|
||
#[arg(short, long, default_value_t = LevelFilter::Info, env)] | ||
pub log_level: log::LevelFilter, | ||
#[arg(short, long, default_value_t = tracing::Level::INFO, env)] | ||
pub log_level: Level, | ||
|
||
#[clap(short='F', long, value_enum, default_value_t=LogFormat::Text, env)] | ||
pub log_format: LogFormat, | ||
} | ||
|
||
pub(crate) fn parse() -> Args { | ||
pub fn parse() -> Args { | ||
return Args::parse(); | ||
} | ||
|
||
#[derive(ValueEnum, Clone, Debug)] | ||
pub enum LogFormat { | ||
Text, | ||
Structured, | ||
Debug | ||
} |
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 was deleted.
Oops, something went wrong.