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
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

View file

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

View file

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

View file

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