From 4705cc213bb0c00ee04fbe6f0a5345cc79ccec0f Mon Sep 17 00:00:00 2001 From: Al Liu Date: Mon, 6 Feb 2023 19:23:25 +0800 Subject: [PATCH] Add constructor for LogSettings (#67) * add constructor for LogSettings --- nomos-services/log/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nomos-services/log/src/lib.rs b/nomos-services/log/src/lib.rs index cb8f13da..78b9c961 100644 --- a/nomos-services/log/src/lib.rs +++ b/nomos-services/log/src/lib.rs @@ -37,6 +37,27 @@ pub struct LoggerSettings { level: Level, } +impl Default for LoggerSettings { + fn default() -> Self { + Self { + backend: LoggerBackend::Stdout, + format: LoggerFormat::Json, + level: Level::DEBUG, + } + } +} + +impl LoggerSettings { + #[inline] + pub const fn new(backend: LoggerBackend, format: LoggerFormat, level: Level) -> Self { + Self { + backend, + format, + level, + } + } +} + #[derive(Clone, Debug, Serialize, Deserialize)] pub enum LoggerFormat { Json,