Enabled logging of warnings

This commit is contained in:
SinTan1729 2023-04-10 11:51:20 -05:00
parent e18a71a73c
commit 66ea86b6d3
4 changed files with 193 additions and 14 deletions

View File

@ -41,7 +41,8 @@ unnecessary features, or they didn't have all the features I wanted.
# Bloat that will not be implemented # Bloat that will not be implemented
- Tracking or spying of any kind. The only logs that still exist are - Tracking or spying of any kind. The only logs that still exist are
errors printed to stderr and the default SLF4J warning. errors printed to stderr and the basic logging (only warnings) provided by the
[`env_logger`](https://crates.io/crates/env_logger) crate.
- User management. If you need a shortener for your whole organization, either - User management. If you need a shortener for your whole organization, either
run separate containers for everyone or use something else. run separate containers for everyone or use something else.
- Cookies, newsletters, "we value your privacy" popups or any of the multiple - Cookies, newsletters, "we value your privacy" popups or any of the multiple

198
actix/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -12,3 +12,4 @@ rusqlite = "0.29.0"
regex = "1.7.3" regex = "1.7.3"
rand = "0.8.5" rand = "0.8.5"
actix-session = {version = "0.7.2", features = ["cookie-session"]} actix-session = {version = "0.7.2", features = ["cookie-session"]}
env_logger = "0.10.0"

View File

@ -105,7 +105,9 @@ async fn delete_link(
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
// Generate session key in runtime so that restarts invalidates older logins env_logger::init_from_env(env_logger::Env::new().default_filter_or("warn"));
// Generate session key in runtime so that restart invalidates older logins
let secret_key = Key::generate(); let secret_key = Key::generate();
let db_location = env::var("db_url").unwrap_or("/urls.sqlite".to_string()); let db_location = env::var("db_url").unwrap_or("/urls.sqlite".to_string());
let port = env::var("port") let port = env::var("port")
@ -124,6 +126,7 @@ async fn main() -> std::io::Result<()> {
.app_data(web::Data::new(AppState { .app_data(web::Data::new(AppState {
db: database::open_db(env::var("db_url").unwrap_or(db_location.clone())), db: database::open_db(env::var("db_url").unwrap_or(db_location.clone())),
})) }))
.wrap(middleware::Logger::default())
.wrap(middleware::Compress::default()) .wrap(middleware::Compress::default())
.service(link_handler) .service(link_handler)
.service(error404) .service(error404)