Skip to content

Commit

Permalink
log level
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed May 9, 2024
1 parent deef59c commit 918d9cd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
23 changes: 18 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ parking_lot = "^0.12.1"
async-channel = "^1.7"
async-recursion = "^1.0.5"
serde_yaml = "^0.8"
eva-common = "^0.3.50"
eva-common = "^0.3.52"
cargo_metadata = "^0.18.1"
itertools = "^0.12.1"
hex = "^0.4.3"
Expand Down
12 changes: 11 additions & 1 deletion eva/src/svcmgr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::eapi::EAPI_VERSION;
use crate::logs::LogLevel;
use crate::MEMORY_WARN_DEFAULT;
use crate::{EResult, Error};
use crate::{BUILD, VERSION};
Expand Down Expand Up @@ -556,6 +557,7 @@ pub struct Params {
launcher: Arc<String>,
#[serde(default)]
call_tracing: bool,
log_level: Option<String>,
}

impl Params {
Expand All @@ -575,6 +577,14 @@ impl Params {
if crate::is_unix_socket!(bus.path()) {
bus.set_path(&format_path(&dir_eva, Some(bus.path()), None));
}
let mut log_level: u8 = crate::logs::get_min_log_level().0;
if let Some(lvl) = &self.log_level {
if lvl == "off" {
log_level = eva_common::LOG_LEVEL_OFF;
} else {
log_level = lvl.parse::<LogLevel>().map_or(log_level, |l| l.0);
}
}
Initial::new(
id,
system_name,
Expand All @@ -587,7 +597,7 @@ impl Params {
VERSION,
EAPI_VERSION,
&dir_eva,
crate::logs::get_min_log_level().0,
log_level,
core_active,
),
bus,
Expand Down
11 changes: 11 additions & 0 deletions share/registry/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ config/logs:
- info
- warn
- error
- "off"
keep: *intzeropositive
max_records: *intzeropositive
required:
Expand Down Expand Up @@ -300,6 +301,16 @@ svc:
react_to_fail: *bool
mem_warn: *intpositiveornull
call_tracing: *bool
log_level:
type: ["string", "null"]
enum:
- trace
- debug
- info
- warn
- error
- "off"
- null
launcher: *str
required:
- bus
Expand Down

0 comments on commit 918d9cd

Please sign in to comment.