mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-25 18:06:29 +00:00
add support for multiple log formats (#517)
this commit adds the tracing-subscriber crate and use its formatters to support multiple log formats. More details in https://github.com/postgresml/pgcat/issues/464#issuecomment-1641430299 Signed-off-by: Sebastian Webber <sebastian@swebber.me>
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user