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;
14mod r#type;
15
16#[cfg(test)]
17#[path = "../tests/mod.rs"]
18mod tests;
19
20pub use {r#const::*, r#enum::*, r#struct::*, r#trait::*, r#type::*};
21
22pub use log::LevelFilter;
23
24pub(crate) use {r#fn::*, r#static::*};
25
26use std::{
27    cell::RefCell,
28    fmt::{self, Debug, Formatter},
29    fs::{File, OpenOptions},
30    io::{self, BufWriter, Write, stdout},
31    sync::{
32        Arc, OnceLock,
33        atomic::{AtomicU64, Ordering},
34        mpsc::{Receiver, RecvError, SyncSender, TrySendError, sync_channel},
35    },
36    thread::{Builder, JoinHandle},
37    thread_local,
38    time::Instant,
39};
40
41use {
42    hyperlane::{
43        CONNECT, Context, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, RequestMethod, ServerHook,
44        Status, Stream, TRACE,
45    },
46    log::{Level, Metadata, Record, SetLoggerError, log_enabled, set_logger, set_max_level},
47};