Merge pull request 'fix ci' (#381) from usage-stats into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m10s
CI/CD Pipeline / deploy-staging (push) Successful in 5m39s
CI/CD Pipeline / deploy-main (push) Has been skipped

Reviewed-on: #381
This commit is contained in:
philipp 2024-04-16 09:07:31 +02:00
commit 6daf2495a8

View File

@ -139,11 +139,17 @@ impl Fairing for Usage {
if !uri.ends_with(".css") && !uri.ends_with(".js") { if !uri.ends_with(".css") && !uri.ends_with(".js") {
let config = req.rocket().state::<Config>().unwrap(); let config = req.rocket().state::<Config>().unwrap();
let mut file = OpenOptions::new() let Ok(mut file) = OpenOptions::new()
.write(true) .write(true)
.append(true) .append(true)
.open(config.usage_log_path.clone()) .open(config.usage_log_path.clone())
.unwrap(); else {
eprintln!(
"File {} can't be found, not saving usage logs",
config.usage_log_path.clone()
);
return;
};
if let Err(e) = writeln!(file, "{timestamp};{user};{uri}") { if let Err(e) = writeln!(file, "{timestamp};{user};{uri}") {
eprintln!("Couldn't write to file: {}", e); eprintln!("Couldn't write to file: {}", e);