summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-29 19:21:29 +0100
committerColin Reeder <colin@vpzom.click>2020-12-29 11:31:55 -0700
commit68fb618980573ee0bd06457e49b792394f191ef3 (patch)
tree9c28e4c5fa84d234e6f1cf09c6ac5dc7af88f7b9
parentc754ef892c49134efc5ea65a75dc8284bab5ff85 (diff)
Add env_logger for logging
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--Cargo.lock59
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs1
3 files changed, 62 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 08f4162..2784790 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -25,6 +25,17 @@ dependencies = [
]
[[package]]
+name = "atty"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+dependencies = [
+ "hermit-abi",
+ "libc",
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -122,6 +133,19 @@ dependencies = [
]
[[package]]
+name = "env_logger"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
+dependencies = [
+ "atty",
+ "humantime",
+ "log",
+ "regex",
+ "termcolor",
+]
+
+[[package]]
name = "fallible-iterator"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -375,11 +399,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
+name = "hermit-abi"
+version = "0.1.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
+dependencies = [
+ "libc",
+]
+
+[[package]]
name = "hitide"
version = "0.8.0-pre"
dependencies = [
"ammonia",
"chrono",
+ "env_logger",
"fallible-iterator",
"fluent",
"fluent-langneg",
@@ -390,6 +424,7 @@ dependencies = [
"hyper",
"hyper-tls",
"lazy_static",
+ "log",
"multer",
"render",
"serde",
@@ -457,6 +492,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"
[[package]]
+name = "humantime"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a"
+
+[[package]]
name = "hyper"
version = "0.13.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1272,6 +1313,15 @@ dependencies = [
]
[[package]]
+name = "termcolor"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
name = "thiserror"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1617,6 +1667,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
+name = "winapi-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+dependencies = [
+ "winapi 0.3.9",
+]
+
+[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index f89498c..089dc69 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,3 +33,5 @@ futures-util = "0.3.5"
hitide_icons = { path = "./icons" }
multer = "1.2.2"
fluent = "0.13.1"
+log = "0.4"
+env_logger = "0.8"
diff --git a/src/main.rs b/src/main.rs
index 1bd7be8..76b2405 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -184,6 +184,7 @@ pub fn get_lang_for_req(req: &hyper::Request<hyper::Body>) -> Translator {
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
+ env_logger::init();
let backend_host = std::env::var("BACKEND_HOST").expect("Missing BACKEND_HOST");
let port = match std::env::var("PORT") {