pub(super) struct JournaldLogger {
shared: Arc<Shared>,
}Expand description
Writes the container output to the journal with the container ID fields
and priorities conmon uses, so that journalctl CONTAINER_ID=<id> finds
it and podman can put partial lines back together.
Fields§
Shared with the blocking tasks which send the entries.
Implementations§
Source§impl JournaldLogger
impl JournaldLogger
Sourceconst SHORT_ID_LEN: usize = 12
const SHORT_ID_LEN: usize = 12
The length of the short container ID field.
Sourceconst PARTIAL_FIELD: (&'static str, &'static str)
const PARTIAL_FIELD: (&'static str, &'static str)
The field marking a line which had no ending yet.
Sourcepub(super) fn new(id: &str, name: &str) -> Self
pub(super) fn new(id: &str, name: &str) -> Self
A logger with the fields conmon writes: the container ID, the name if given and the syslog identifier, which is the name, or the short container ID without one, like for conmon without a tag.
Sourcefn send(shared: &Shared, pipe: Pipe, lines: &[Line<'_>], wait: Wait) -> usize
fn send(shared: &Shared, pipe: Pipe, lines: &[Line<'_>], wait: Wait) -> usize
Send the lines to the journal and return how many of them it took or got dropped. A journal which is unavailable, for example while it restarts, must not end the output of the container, so failures are only logged, once until a send succeeds again. Without a journal, or with one which did not take a line in time, the rest of the chunk is dropped right away instead of failing the same way line by line. Without waiting, the sending stops at the first line which the journal does not take right away. Waiting, the lines which did not go out by the deadline of the wait get dropped, a journal which takes each line just in time would block the log of the container for minutes per chunk otherwise.
Source§impl JournaldLogger
impl JournaldLogger
Sourcepub(super) async fn write_lines(
&self,
pipe: Pipe,
lines: &[Line<'_>],
) -> Result<()>
pub(super) async fn write_lines( &self, pipe: Pipe, lines: &[Line<'_>], ) -> Result<()>
Write whole lines of output of the pipe, one entry each. A journal
which keeps up takes the lines right away. The ones it does not take
are sent from a single blocking task, which waits for it a bounded
time, instead of one per line, unless the last wait timed out, see
Shared::timed_out. The lines which borrow the chunk get copied for
it, the others share their buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JournaldLogger
impl RefUnwindSafe for JournaldLogger
impl Send for JournaldLogger
impl Sync for JournaldLogger
impl Unpin for JournaldLogger
impl UnsafeUnpin for JournaldLogger
impl UnwindSafe for JournaldLogger
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].