-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dac042
commit 66085bb
Showing
8 changed files
with
364 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "eigen-logging" | ||
version.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
repository.workspace = true | ||
|
||
[dependencies] | ||
tracing.workspace = true | ||
tracing-subscriber.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![doc( | ||
html_logo_url = "https://github.com/supernovahs/eigensdk-rs/assets/91280922/bd13caec-3c00-4afc-839a-b83d2890beb5", | ||
issue_tracker_base_url = "https://github.com/supernovahs/eigen-rs/issues/" | ||
)] | ||
#![cfg_attr(not(test), warn(unused_crate_dependencies))] | ||
|
||
pub mod log_level; | ||
pub mod logger; | ||
pub mod noop_logger; | ||
pub mod tracing_logger; | ||
|
||
pub static COMPONENT_KEY: &str = "component"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#[derive(Default, Debug)] | ||
pub enum LogLevel { | ||
Error, | ||
Warn, | ||
#[default] | ||
Info, | ||
Debug, | ||
Trace, | ||
Fatal, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use super::log_level::LogLevel; | ||
use std::fmt::Debug; | ||
|
||
pub trait Logger { | ||
type LoggerType: Logger; | ||
|
||
fn new_text_logger( | ||
no_color: bool, | ||
time_format: String, | ||
level: LogLevel, | ||
add_source: bool, | ||
) -> Self::LoggerType; | ||
|
||
fn new_json_logger( | ||
no_color: bool, | ||
time_format: String, | ||
level: LogLevel, | ||
add_source: bool, | ||
) -> Self::LoggerType; | ||
|
||
fn debug(&self, msg: &str, args: &[impl Debug]); | ||
fn info(&self, msg: &str, args: &[impl Debug]); | ||
fn warn(&self, msg: &str, args: &[impl Debug]); | ||
fn error(&self, msg: &str, args: &[impl Debug]); | ||
fn fatal(&self, msg: &str, args: &[impl Debug]); | ||
|
||
fn log(&self, msg: &str, args: &[impl Debug]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use super::log_level::LogLevel; | ||
use super::logger::Logger; | ||
use std::fmt::Debug; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct NoopLogger {} | ||
|
||
impl Logger for NoopLogger { | ||
type LoggerType = NoopLogger; | ||
|
||
fn new_text_logger( | ||
_no_color: bool, | ||
_time_format: String, | ||
_level: LogLevel, | ||
_add_source: bool, | ||
) -> Self::LoggerType { | ||
NoopLogger {} | ||
} | ||
|
||
fn new_json_logger( | ||
_no_color: bool, | ||
_time_format: String, | ||
_level: LogLevel, | ||
_add_source: bool, | ||
) -> Self::LoggerType { | ||
NoopLogger {} | ||
} | ||
|
||
fn debug(&self, _msg: &str, _args: &[impl Debug]) {} | ||
fn info(&self, _msg: &str, _args: &[impl Debug]) {} | ||
fn warn(&self, _msg: &str, _args: &[impl Debug]) {} | ||
fn error(&self, _msg: &str, _args: &[impl Debug]) {} | ||
fn fatal(&self, _msg: &str, _args: &[impl Debug]) {} | ||
|
||
fn log(&self, _msg: &str, _args: &[impl Debug]) {} | ||
} |
Oops, something went wrong.