mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-25 14:10:06 +01:00
Introduce the stderr logger to the project
This commit is contained in:
parent
12358476da
commit
f757df5dfd
@ -55,6 +55,10 @@ struct Opt {
|
|||||||
#[structopt(long, default_value = "4294967296")]
|
#[structopt(long, default_value = "4294967296")]
|
||||||
max_memory_usage: usize,
|
max_memory_usage: usize,
|
||||||
|
|
||||||
|
/// Verbose mode (-v, -vv, -vvv, etc.)
|
||||||
|
#[structopt(short, long, parse(from_occurrences))]
|
||||||
|
verbose: usize,
|
||||||
|
|
||||||
/// CSV file to index, if unspecified the CSV is read from standard input.
|
/// CSV file to index, if unspecified the CSV is read from standard input.
|
||||||
csv_file: Option<PathBuf>,
|
csv_file: Option<PathBuf>,
|
||||||
}
|
}
|
||||||
@ -417,6 +421,12 @@ fn compute_words_attributes_docids(wtxn: &mut heed::RwTxn, index: &Index) -> any
|
|||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
let opt = Opt::from_args();
|
let opt = Opt::from_args();
|
||||||
|
|
||||||
|
stderrlog::new()
|
||||||
|
.verbosity(opt.verbose)
|
||||||
|
.show_level(false)
|
||||||
|
.timestamp(stderrlog::Timestamp::Off)
|
||||||
|
.init()?;
|
||||||
|
|
||||||
if let Some(jobs) = opt.jobs {
|
if let Some(jobs) = opt.jobs {
|
||||||
rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global()?;
|
rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global()?;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,10 @@ struct Opt {
|
|||||||
#[structopt(long = "db", parse(from_os_str))]
|
#[structopt(long = "db", parse(from_os_str))]
|
||||||
database: PathBuf,
|
database: PathBuf,
|
||||||
|
|
||||||
|
/// Verbose mode (-v, -vv, -vvv, etc.)
|
||||||
|
#[structopt(short, long, parse(from_occurrences))]
|
||||||
|
verbose: usize,
|
||||||
|
|
||||||
/// The query string to search for (doesn't support prefix search yet).
|
/// The query string to search for (doesn't support prefix search yet).
|
||||||
query: Option<String>,
|
query: Option<String>,
|
||||||
}
|
}
|
||||||
@ -27,6 +31,12 @@ struct Opt {
|
|||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
let opt = Opt::from_args();
|
let opt = Opt::from_args();
|
||||||
|
|
||||||
|
stderrlog::new()
|
||||||
|
.verbosity(opt.verbose)
|
||||||
|
.show_level(false)
|
||||||
|
.timestamp(stderrlog::Timestamp::Off)
|
||||||
|
.init()?;
|
||||||
|
|
||||||
std::fs::create_dir_all(&opt.database)?;
|
std::fs::create_dir_all(&opt.database)?;
|
||||||
let env = EnvOpenOptions::new()
|
let env = EnvOpenOptions::new()
|
||||||
.map_size(100 * 1024 * 1024 * 1024) // 100 GB
|
.map_size(100 * 1024 * 1024 * 1024) // 100 GB
|
||||||
|
@ -29,6 +29,10 @@ struct Opt {
|
|||||||
#[structopt(long = "db-size", default_value = "107374182400")] // 100 GB
|
#[structopt(long = "db-size", default_value = "107374182400")] // 100 GB
|
||||||
database_size: usize,
|
database_size: usize,
|
||||||
|
|
||||||
|
/// Verbose mode (-v, -vv, -vvv, etc.)
|
||||||
|
#[structopt(short, long, parse(from_occurrences))]
|
||||||
|
verbose: usize,
|
||||||
|
|
||||||
/// The ip and port on which the database will listen for HTTP requests.
|
/// The ip and port on which the database will listen for HTTP requests.
|
||||||
#[structopt(short = "l", long, default_value = "127.0.0.1:9700")]
|
#[structopt(short = "l", long, default_value = "127.0.0.1:9700")]
|
||||||
http_listen_addr: String,
|
http_listen_addr: String,
|
||||||
@ -46,6 +50,12 @@ struct IndexTemplate {
|
|||||||
async fn main() -> anyhow::Result<()> {
|
async fn main() -> anyhow::Result<()> {
|
||||||
let opt = Opt::from_args();
|
let opt = Opt::from_args();
|
||||||
|
|
||||||
|
stderrlog::new()
|
||||||
|
.verbosity(opt.verbose)
|
||||||
|
.show_level(false)
|
||||||
|
.timestamp(stderrlog::Timestamp::Off)
|
||||||
|
.init()?;
|
||||||
|
|
||||||
std::fs::create_dir_all(&opt.database)?;
|
std::fs::create_dir_all(&opt.database)?;
|
||||||
let env = EnvOpenOptions::new()
|
let env = EnvOpenOptions::new()
|
||||||
.map_size(opt.database_size)
|
.map_size(opt.database_size)
|
||||||
@ -158,7 +168,6 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.or(query_route);
|
.or(query_route);
|
||||||
|
|
||||||
let addr = SocketAddr::from_str(&opt.http_listen_addr).unwrap();
|
let addr = SocketAddr::from_str(&opt.http_listen_addr).unwrap();
|
||||||
println!("listening on http://{}", addr);
|
|
||||||
warp::serve(routes).run(addr).await;
|
warp::serve(routes).run(addr).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user