mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-10 10:05:17 +00:00
fix:log config : invalid filter directive (#146)
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled
Some checks failed
abi-consistent-check / build-and-compare (push) Has been cancelled
code-coverage / unittest-cov (push) Has been cancelled
rust / check (push) Has been cancelled
rust / test (push) Has been cancelled
rust / lints (push) Has been cancelled
functional-test / test (push) Has been cancelled
This commit is contained in:
parent
d80e7e22ca
commit
77d1b84974
@ -20,10 +20,13 @@ pub fn configure(log_level_file: &str, log_directory: &str, executor: TaskExecut
|
|||||||
let handle = builder.reload_handle();
|
let handle = builder.reload_handle();
|
||||||
builder.init();
|
builder.init();
|
||||||
|
|
||||||
let level_file = log_level_file.to_string();
|
let level_file = log_level_file.trim_end().to_string();
|
||||||
|
|
||||||
// load config synchronously
|
// load config synchronously
|
||||||
let mut config = std::fs::read_to_string(&level_file).unwrap_or_default();
|
let mut config = std::fs::read_to_string(&level_file)
|
||||||
|
.unwrap_or_default()
|
||||||
|
.trim_end()
|
||||||
|
.to_string();
|
||||||
let _ = handle.reload(&config);
|
let _ = handle.reload(&config);
|
||||||
|
|
||||||
// periodically check for config changes
|
// periodically check for config changes
|
||||||
@ -38,8 +41,14 @@ pub fn configure(log_level_file: &str, log_directory: &str, executor: TaskExecut
|
|||||||
interval.tick().await;
|
interval.tick().await;
|
||||||
|
|
||||||
let new_config = match tokio::fs::read_to_string(&level_file).await {
|
let new_config = match tokio::fs::read_to_string(&level_file).await {
|
||||||
Ok(c) if c == config => continue,
|
Ok(c) => {
|
||||||
Ok(c) => c,
|
let nc = c.trim_end().to_string();
|
||||||
|
if nc == config {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
nc
|
||||||
|
}
|
||||||
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Unable to read log file {}: {:?}", level_file, e);
|
println!("Unable to read log file {}: {:?}", level_file, e);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user