pub struct LogxWriter { /* private fields */ }Expand description
A rotating NDJSON writer.
Single instance, internally locked. The tracing layer in
tracing_layer::LogxLayer calls write_record once per event.
Implementations§
Source§impl LogxWriter
impl LogxWriter
Sourcepub fn open(dir: &Path, base: &str, rotate_bytes: u64) -> Result<Self>
pub fn open(dir: &Path, base: &str, rotate_bytes: u64) -> Result<Self>
Create or reopen the active log file under dir/base.ndjson.
Creates dir if it does not exist.
Sourcepub fn write_record(&self, record: String) -> Result<()>
pub fn write_record(&self, record: String) -> Result<()>
Write one NDJSON record. The caller hands in the fully-formed
JSON line (no trailing newline); this method runs the redactor,
appends \n, and rotates if the cap is crossed.
Sourcepub fn rotate_now(&self) -> Result<()>
pub fn rotate_now(&self) -> Result<()>
Force a rotation regardless of size. Tests and ops tools.
Auto Trait Implementations§
impl !Freeze for LogxWriter
impl RefUnwindSafe for LogxWriter
impl Send for LogxWriter
impl Sync for LogxWriter
impl Unpin for LogxWriter
impl UnsafeUnpin for LogxWriter
impl UnwindSafe for LogxWriter
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