Skip to main content

hyperlane_plugin_logger/
lib.rs

1//! hyperlane-plugin-logger
2//!
3//! A high-concurrency logging plugin for the Hyperlane framework with
4//! non-blocking buffered file output, pluggable sinks, plain/JSON formats,
5//! and CRLF/ANSI log-forging sanitization.
6
7mod r#const;
8mod r#enum;
9mod r#fn;
10mod r#impl;
11mod r#static;
12mod r#struct;
13mod r#trait;
14
15#[cfg(test)]
16#[path = "../tests/mod.rs"]
17mod tests;
18
19pub use {r#const::*, r#enum::*, r#struct::*, r#trait::*};
20
21pub use log::LevelFilter;
22
23pub(crate) use {r#fn::*, r#static::*};
24
25use std::{
26    cell::RefCell,
27    fmt::{self, Debug, Formatter},
28    fs::{File, OpenOptions},
29    io::{self, BufWriter, Write, stdout},
30    sync::{
31        Arc, OnceLock,
32        atomic::{AtomicU64, Ordering},
33        mpsc::{Receiver, RecvError, SyncSender, TrySendError, sync_channel},
34    },
35    thread::{Builder, JoinHandle},
36    thread_local,
37    time::Instant,
38};
39
40use {
41    hyperlane::{
42        CONNECT, Context, DELETE, GET, HEAD, Method, OPTIONS, PATCH, POST, PUT, ServerHook, Status,
43        Stream, TRACE,
44    },
45    log::{Level, Metadata, Record, SetLoggerError, log_enabled, set_logger, set_max_level},
46};