remove silent flag in favour of RUST_LOG

This commit is contained in:
Johann150 2021-03-26 20:29:35 +01:00
parent 2934350485
commit d24db63583
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1
4 changed files with 12 additions and 14 deletions

View file

@ -133,7 +133,7 @@ If this is the `.meta` file in the content root directory and the `-C` flag is u
### Logging Verbosity ### Logging Verbosity
Agate uses the `env_logger` crate and allows you to set the logging verbosity by setting the default `RUST_LOG` environment variable. For more information, please see the [documentation of `env_logger`]. Agate uses the `env_logger` crate and allows you to set the logging verbosity by setting the `RUST_LOG` environment variable. To turn off all logging use `RUST_LOG=off`. For more information, please see the [documentation of `env_logger`].
### Virtual Hosts ### Virtual Hosts

View file

@ -204,6 +204,11 @@ impl CertStore {
a.len().cmp(&b.len()).reverse() a.len().cmp(&b.len()).reverse()
}); });
log::debug!(
"certs loaded for {:?}",
certs.iter().map(|t| &t.0).collect::<Vec<_>>()
);
Ok(Self { certs }) Ok(Self { certs })
} }

View file

@ -28,15 +28,11 @@ use {
}; };
fn main() -> Result { fn main() -> Result {
if !ARGS.silent { env_logger::Builder::from_env(
env_logger::Builder::new() // by default only turn on logging for agate
// turn off logging for other modules env_logger::Env::default().default_filter_or("agate=info"),
.filter_level(log::LevelFilter::Off) )
// turn on logging for agate .init();
.filter_module("agate", log::LevelFilter::Info)
.parse_default_env()
.init();
}
Runtime::new()?.block_on(async { Runtime::new()?.block_on(async {
let default = PresetMeta::Parameters( let default = PresetMeta::Parameters(
ARGS.language ARGS.language
@ -79,7 +75,6 @@ struct Args {
certs: Arc<certificates::CertStore>, certs: Arc<certificates::CertStore>,
hostnames: Vec<Host>, hostnames: Vec<Host>,
language: Option<String>, language: Option<String>,
silent: bool,
serve_secret: bool, serve_secret: bool,
log_ips: bool, log_ips: bool,
only_tls13: bool, only_tls13: bool,
@ -119,7 +114,6 @@ fn args() -> Result<Args> {
"RFC 4646 Language code for text/gemini documents", "RFC 4646 Language code for text/gemini documents",
"LANG", "LANG",
); );
opts.optflag("s", "silent", "Disable logging output");
opts.optflag("h", "help", "Print this help text and exit."); opts.optflag("h", "help", "Print this help text and exit.");
opts.optflag("V", "version", "Print version information and exit."); opts.optflag("V", "version", "Print version information and exit.");
opts.optflag( opts.optflag(
@ -173,7 +167,6 @@ fn args() -> Result<Args> {
certs, certs,
hostnames, hostnames,
language: matches.opt_str("lang"), language: matches.opt_str("lang"),
silent: matches.opt_present("s"),
serve_secret: matches.opt_present("serve-secret"), serve_secret: matches.opt_present("serve-secret"),
log_ips: matches.opt_present("log-ip"), log_ips: matches.opt_present("log-ip"),
only_tls13: matches.opt_present("only-tls13"), only_tls13: matches.opt_present("only-tls13"),

View file

@ -107,7 +107,7 @@ impl FileOptions {
/// (Re)reads a specified sidecar file. /// (Re)reads a specified sidecar file.
/// This function will allways try to read the file, even if it is current. /// This function will allways try to read the file, even if it is current.
fn read_database(&mut self, db: &PathBuf) { fn read_database(&mut self, db: &PathBuf) {
log::trace!("reading database {:?}", db); log::debug!("reading database {:?}", db);
let mut ini = Ini::new_cs(); let mut ini = Ini::new_cs();
ini.set_default_section("mime"); ini.set_default_section("mime");