pub struct JsonFormatter;Expand description
JSON formatter for machine-readable output
Transforms messages into JSON objects with metadata including:
- Message type (for programmatic filtering)
- Channel (stdout/stderr)
- Content (the formatted message)
- Timestamp (ISO 8601 format)
§Examples
ⓘ
use torrust_tracker_deployer_lib::presentation::cli::views::{JsonFormatter, UserOutput, VerbosityLevel};
let formatter = JsonFormatter;
let mut output = UserOutput::with_formatter_override(
VerbosityLevel::Normal,
Box::new(formatter)
);
output.progress("Starting process");
// Output: {"type":"ProgressMessage","channel":"Stderr","content":"⏳ Starting process","timestamp":"2025-11-04T12:34:56Z"}Trait Implementations§
Source§impl FormatterOverride for JsonFormatter
impl FormatterOverride for JsonFormatter
Auto Trait Implementations§
impl Freeze for JsonFormatter
impl RefUnwindSafe for JsonFormatter
impl Send for JsonFormatter
impl Sync for JsonFormatter
impl Unpin for JsonFormatter
impl UnsafeUnpin for JsonFormatter
impl UnwindSafe for JsonFormatter
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request