2023-07-19 03:07:13 -03:00
|
|
|
use clap::{Parser, ValueEnum};
|
|
|
|
|
use tracing::Level;
|
2023-07-18 17:52:40 -03:00
|
|
|
|
|
|
|
|
/// PgCat: Nextgen PostgreSQL Pooler
|
|
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
|
#[command(author, version, about, long_about = None)]
|
2023-07-19 03:07:13 -03:00
|
|
|
pub struct Args {
|
2023-07-18 17:52:40 -03:00
|
|
|
#[arg(default_value_t = String::from("pgcat.toml"), env)]
|
|
|
|
|
pub config_file: String,
|
|
|
|
|
|
2023-07-19 03:07:13 -03:00
|
|
|
#[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,
|
2023-07-20 01:15:55 -03:00
|
|
|
|
|
|
|
|
#[arg(
|
|
|
|
|
short,
|
|
|
|
|
long,
|
|
|
|
|
default_value_t = false,
|
|
|
|
|
env,
|
|
|
|
|
help = "disable colors in the log output"
|
|
|
|
|
)]
|
|
|
|
|
pub no_color: bool,
|
2023-07-18 17:52:40 -03:00
|
|
|
}
|
|
|
|
|
|
2023-07-19 03:07:13 -03:00
|
|
|
pub fn parse() -> Args {
|
2023-07-18 17:52:40 -03:00
|
|
|
return Args::parse();
|
|
|
|
|
}
|
2023-07-19 03:07:13 -03:00
|
|
|
|
|
|
|
|
#[derive(ValueEnum, Clone, Debug)]
|
|
|
|
|
pub enum LogFormat {
|
|
|
|
|
Text,
|
|
|
|
|
Structured,
|
|
|
|
|
Debug,
|
|
|
|
|
}
|