pub enum LogOutput {
StdOut {
message: Bytes,
},
StdErr {
message: Bytes,
},
StdIn {
message: Bytes,
},
Console {
message: Bytes,
},
}Expand description
Represents a single log output entry from a container.
Container logs can come from different streams (stdout, stderr, stdin) and this enum represents which stream the log entry came from along with its content.
§Accessing Log Content
You can access the log content via pattern matching or helper methods:
use atlas_local::models::LogOutput;
use bytes::Bytes;
let log = LogOutput::StdOut {
message: Bytes::from("Hello, world!\n"),
};
// Pattern matching
match log {
LogOutput::StdOut { message } => {
println!("stdout: {:?}", message);
}
LogOutput::StdErr { message } => {
println!("stderr: {:?}", message);
}
_ => {}
}
// Or use helper methods
let log = LogOutput::StdOut {
message: Bytes::from("Hello, world!\n"),
};
println!("Message: {}", log.as_str_lossy());
println!("Bytes: {:?}", log.as_bytes());Variants§
StdOut
Standard output log entry
StdErr
Standard error log entry
StdIn
Standard input log entry
Console
Console log entry
Implementations§
Source§impl LogOutput
impl LogOutput
Sourcepub fn as_str_lossy(&self) -> Cow<'_, str>
pub fn as_str_lossy(&self) -> Cow<'_, str>
Returns the message content as a UTF-8 string, replacing invalid sequences.
Sourcepub fn is_console(&self) -> bool
pub fn is_console(&self) -> bool
Returns true if this is a console log entry.
Trait Implementations§
impl Eq for LogOutput
impl StructuralPartialEq for LogOutput
Auto Trait Implementations§
impl !Freeze for LogOutput
impl RefUnwindSafe for LogOutput
impl Send for LogOutput
impl Sync for LogOutput
impl Unpin for LogOutput
impl UnsafeUnpin for LogOutput
impl UnwindSafe for LogOutput
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