blob: 0ec0796606ee349bba0d8cddf1e08fdd32b50859 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
// SPDX-License-Identifier: GPL-3.0-only
use std::error::Error;
use whirl::{cli::Cli, config::Config, utils::log::calculate_log_level};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Environment
let matches = Cli::setup();
// Logging
dotenv::dotenv().ok();
let logger = flexi_logger::Logger::with_str(calculate_log_level());
if std::env::var("LOG_FILE").unwrap_or_else(|_| "true".to_string()) == "false"
|| !Config::get().whirlsplash.log.file
{
logger.start()?;
} else {
logger
.print_message()
.log_to_file()
.directory("log")
.start()?;
}
// Execution
Cli::execute(matches).await.unwrap();
Ok(())
}
|