commit d24db6358305b1594b5081eb08cbc6da417a7cfa
parent 2934350485f1a5f00e99d0f2f024894b5544e5cd
Author: Johann150 <johann.galle@protonmail.com>
Date: Fri, 26 Mar 2021 20:29:35 +0100
remove silent flag in favour of RUST_LOG
Diffstat:
4 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/README.md b/README.md
@@ -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
diff --git a/src/certificates.rs b/src/certificates.rs
@@ -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 })
}
diff --git a/src/main.rs b/src/main.rs
@@ -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"),
diff --git a/src/metadata.rs b/src/metadata.rs
@@ -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");