Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename ceresformat to logformat #1417

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions components/logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ fn get_string_by_level(lv: Level) -> &'static str {
}
}

pub fn term_drainer() -> CeresFormat<TermDecorator> {
pub fn term_drainer() -> LogFormat<TermDecorator> {
let decorator = TermDecorator::new().stdout().build();
CeresFormat::new(decorator)
LogFormat::new(decorator)
}

pub fn file_drainer(path: &Option<String>) -> Option<CeresFormat<PlainDecorator<File>>> {
pub fn file_drainer(path: &Option<String>) -> Option<LogFormat<PlainDecorator<File>>> {
match path {
Some(path) => {
let file = OpenOptions::new()
Expand All @@ -92,7 +92,7 @@ pub fn file_drainer(path: &Option<String>) -> Option<CeresFormat<PlainDecorator<
.open(path)
.unwrap();
let decorator = PlainDecorator::new(file);
Some(CeresFormat::new(decorator))
Some(LogFormat::new(decorator))
}
None => None,
}
Expand Down Expand Up @@ -223,14 +223,14 @@ where
// ```text
// 2020-01-20 13:00:14.998 INFO [src/engine/rocksdb/rocks_kv.rs:394] RocksKV::open_with_op start, name:autogen
// ```
pub struct CeresFormat<D>
pub struct LogFormat<D>
where
D: Decorator,
{
decorator: D,
}

impl<D> CeresFormat<D>
impl<D> LogFormat<D>
where
D: Decorator,
{
Expand All @@ -239,7 +239,7 @@ where
}
}

impl<D> Drain for CeresFormat<D>
impl<D> Drain for LogFormat<D>
where
D: Decorator,
{
Expand Down Expand Up @@ -458,10 +458,7 @@ pub fn init_test_logger() {

// drain
let term_drain = term_drainer();
let drain = LogDispatcher::new(
term_drain,
Option::<CeresFormat<PlainDecorator<File>>>::None,
);
let drain = LogDispatcher::new(term_drain, Option::<LogFormat<PlainDecorator<File>>>::None);

// Use async and init stdlog
let _ = init_log_from_drain(drain, level, false, 12400, true);
Expand Down
Loading