Skip to content

Commit

Permalink
chore(jans-lock): rename unexported field in the writer
Browse files Browse the repository at this point in the history
Signed-off-by: Oleh Bohzok <olehbozhok@gmail.com>
  • Loading branch information
olehbozhok committed Sep 21, 2024
1 parent f290efa commit 2c43495
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jans-lock/cedarling/cedarling/src/log/stdout_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ use std::{cell::RefCell, io::Write, rc::Rc};
/// A logger that do nothing.
pub(crate) struct StdOutLogger {
// we use `dyn Write`` trait to make it testable and mockable.
writer_ok: RefCell<Box<dyn Write>>,
writer: RefCell<Box<dyn Write>>,
}

impl StdOutLogger {
pub(crate) fn new() -> Self {
Self {
writer_ok: RefCell::new(Box::new(std::io::stdout())),
writer: RefCell::new(Box::new(std::io::stdout())),
}
}

Expand All @@ -27,7 +27,7 @@ impl StdOutLogger {
#[allow(dead_code)]
pub(crate) fn new_with(writer: Box<dyn Write>) -> Self {
Self {
writer_ok: RefCell::new(writer),
writer: RefCell::new(writer),
}
}
}
Expand All @@ -38,7 +38,7 @@ impl LogWriter for StdOutLogger {
let json_str = serde_json::json!(&entry).to_string();
// we can't handle error here or test it so we just panic if it happens.
// we should have specific platform to get error
writeln!(self.writer_ok.borrow_mut(), "{}", &json_str).unwrap();
writeln!(self.writer.borrow_mut(), "{}", &json_str).unwrap();
}
}

Expand Down

0 comments on commit 2c43495

Please sign in to comment.