pub struct Logger { /* private fields */ }Expand description
Logger for Ralph output.
Provides consistent, colorized output with optional file logging. All messages include timestamps and appropriate icons.
Implementations§
Source§impl Logger
impl Logger
Sourcepub const fn new(colors: Colors) -> Self
pub const fn new(colors: Colors) -> Self
Create a new Logger with the given colors configuration.
Sourcepub fn with_log_file(self, path: &str) -> Self
pub fn with_log_file(self, path: &str) -> Self
Configure the logger to also write to a file using direct filesystem access.
Log messages written to the file will have ANSI codes stripped.
§Note
For pipeline code where a workspace exists, prefer [with_workspace_log]
instead. This method uses std::fs directly and is intended for CLI layer
code or legacy compatibility.
Sourcepub fn with_workspace_log(
self,
workspace: Arc<dyn Workspace>,
relative_path: &str,
) -> Self
pub fn with_workspace_log( self, workspace: Arc<dyn Workspace>, relative_path: &str, ) -> Self
Configure the logger to write logs via a workspace.
This is the preferred method for pipeline code where a workspace exists.
Log messages will be written using the workspace abstraction, allowing
for testing with MemoryWorkspace.
§Arguments
workspace- The workspace to use for file operationsrelative_path- Path relative to workspace root for the log file
Trait Implementations§
Source§impl Printable for Logger
impl Printable for Logger
Source§fn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
Check if this printer is connected to a terminal. Read more
Source§impl Write for Logger
impl Write for Logger
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl Freeze for Logger
impl !RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl !UnwindSafe for Logger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more