make log_timestamp actually do something

This commit is contained in:
Alex Janka 2024-04-02 08:41:34 +11:00
parent 207a5b8917
commit 7b5816bed7
4 changed files with 13 additions and 4 deletions

2
Cargo.lock generated
View file

@ -1143,7 +1143,7 @@ dependencies = [
[[package]]
name = "homekit-exporter"
version = "0.5.3"
version = "0.5.4"
dependencies = [
"clap",
"env_logger",

View file

@ -1,6 +1,6 @@
[package]
name = "homekit-exporter"
version = "0.5.3"
version = "0.5.4"
edition = "2021"
license = "Apache-2.0"
description = "Prometheus exporter for HomeKit sensors"

View file

@ -1,7 +1,7 @@
# Maintainer: Alex Janka <alex@alexjanka.com>
pkgname=homekit-logger
pkgver=0.5.3
pkgver=0.5.4
pkgrel=1
pkgdesc="Prometheus exporter for HomeKit sensors"
arch=('x86_64' 'aarch64')

View file

@ -44,7 +44,16 @@ const MONITORED_CHARACTERISTICS: [CharacteristicType; 7] = [
#[launch]
async fn rocket() -> rocket::Rocket<rocket::Build> {
env_logger::init();
env_logger::builder()
.format_module_path(false)
.format_timestamp(
if std::env::var("LOG_TIMESTAMP").is_ok_and(|v| v == "false") {
None
} else {
Some(env_logger::TimestampPrecision::Seconds)
},
)
.init();
let args = Args::parse();
match args.command {