logging improvements
This commit is contained in:
parent
27c8697899
commit
3f19aaa7c3
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2256,7 +2256,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tesla-charge-controller"
|
name = "tesla-charge-controller"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-channel",
|
"async-channel",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tesla-charge-controller"
|
name = "tesla-charge-controller"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MITNFA"
|
license = "MITNFA"
|
||||||
description = "Controls Tesla charge rate based on solar charge data"
|
description = "Controls Tesla charge rate based on solar charge data"
|
||||||
|
|
1
debian/service
vendored
1
debian/service
vendored
|
@ -9,6 +9,7 @@ Restart=always
|
||||||
RestartSec=10s
|
RestartSec=10s
|
||||||
User=tesla
|
User=tesla
|
||||||
Environment="RUST_LOG=error,warn"
|
Environment="RUST_LOG=error,warn"
|
||||||
|
Environment="LOG_TIMESTAMP=false"
|
||||||
ExecStart=/usr/bin/tesla-charge-controller watch
|
ExecStart=/usr/bin/tesla-charge-controller watch
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -39,7 +39,16 @@ enum Commands {
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
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 auth_path = args.config_dir.join("auth");
|
let auth_path = args.config_dir.join("auth");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue