mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
add the log_level variable to the cli and reduce the log level of milli and grenad
This commit is contained in:
parent
b4fd4212ad
commit
36f32f58d4
@ -19,8 +19,12 @@ const SENTRY_DSN: &str = "https://5ddfa22b95f241198be2271aaf028653@sentry.io/306
|
|||||||
async fn main() -> Result<(), MainError> {
|
async fn main() -> Result<(), MainError> {
|
||||||
let opt = Opt::from_args();
|
let opt = Opt::from_args();
|
||||||
|
|
||||||
let mut log_builder =
|
let mut log_builder = env_logger::Builder::new();
|
||||||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"));
|
log_builder.parse_filters(&opt.log_level);
|
||||||
|
if opt.log_level == "info" {
|
||||||
|
// if we are in info we only allow the warn log_level for milli
|
||||||
|
log_builder.filter_module("milli", log::LevelFilter::Warn);
|
||||||
|
}
|
||||||
|
|
||||||
match opt.env.as_ref() {
|
match opt.env.as_ref() {
|
||||||
"production" => {
|
"production" => {
|
||||||
|
@ -188,6 +188,10 @@ pub struct Opt {
|
|||||||
#[structopt(long, conflicts_with = "import-snapshot")]
|
#[structopt(long, conflicts_with = "import-snapshot")]
|
||||||
pub import_dump: Option<PathBuf>,
|
pub import_dump: Option<PathBuf>,
|
||||||
|
|
||||||
|
/// Set the log level
|
||||||
|
#[structopt(long, env = "MEILI_LOG_LEVEL", default_value = "info")]
|
||||||
|
pub log_level: String,
|
||||||
|
|
||||||
#[structopt(skip)]
|
#[structopt(skip)]
|
||||||
pub indexer_options: IndexerOpts,
|
pub indexer_options: IndexerOpts,
|
||||||
}
|
}
|
||||||
|
@ -91,5 +91,6 @@ pub fn default_settings(dir: impl AsRef<Path>) -> Opt {
|
|||||||
snapshot_interval_sec: 0,
|
snapshot_interval_sec: 0,
|
||||||
import_dump: None,
|
import_dump: None,
|
||||||
indexer_options: IndexerOpts::default(),
|
indexer_options: IndexerOpts::default(),
|
||||||
|
log_level: "off".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user