From 6aa6c70af607ede55f9dafef7278b192a2a6b9d0 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 9 Nov 2018 19:47:46 +0100 Subject: Set up a file logger Get a file path from the `LOG_FILE` environment variable and use it for log output. Call `database::get_database_connection()` and log the error if it fails. Worried about exiting early from the FastCGI program, as DreamHost says this causes problems (https://help.dreamhost.com/hc/en-us/articles/217298967). But I don't see how the program can continue without a database connection. Return a `Result` from `main()` because it's easier to use the `?` operator for errors that happen before logging is initialised. --- license-generator/src/errors.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'license-generator/src/errors.rs') diff --git a/license-generator/src/errors.rs b/license-generator/src/errors.rs index 29f25ca..0a28341 100644 --- a/license-generator/src/errors.rs +++ b/license-generator/src/errors.rs @@ -1,9 +1,12 @@ +use log; use mysql; error_chain! { foreign_links { EnvVar(::std::env::VarError); + Io(::std::io::Error); + Log(log::SetLoggerError); MySql(mysql::error::Error); } } -- cgit v1.2.3