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

Reviewed-on: #383
This commit is contained in:
philipp 2024-04-16 09:08:26 +02:00
commit 0a01b95c85

View File

@ -139,11 +139,17 @@ impl Fairing for Usage {
if !uri.ends_with(".css") && !uri.ends_with(".js") {
let config = req.rocket().state::<Config>().unwrap();
let mut file = OpenOptions::new()
let Ok(mut file) = OpenOptions::new()
.write(true)
.append(true)
.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}") {
eprintln!("Couldn't write to file: {}", e);