hyperlane_plugin_logger/struct.rs
1use super::*;
2
3/// The configuration of the logger.
4#[derive(Clone)]
5pub struct LoggerConfig {
6 /// The highest level that is written.
7 pub(crate) level: LevelFilter,
8 /// The file the log is appended to, when there is one.
9 pub(crate) file: Option<String>,
10 /// Whether formatted lines are also echoed to standard output.
11 pub(crate) console: bool,
12 /// Output line format (plain text or structured JSON).
13 pub(crate) format: LogFormat,
14 /// Bounded non-blocking channel capacity for background file writes.
15 pub(crate) channel_capacity: usize,
16 /// Optional custom extensible output sink invoked alongside built-in outputs.
17 pub(crate) sink: Option<SharedLogSink>,
18}
19
20/// The plugin that writes the log of the server.
21#[derive(Clone, Copy, Debug, Default)]
22pub struct LoggerPlugin;
23
24/// The middleware that notes when a request arrived.
25#[derive(Clone, Copy, Debug, Default)]
26#[hyperlane::request_middleware(-120)]
27pub struct RequestLogger;
28
29/// The middleware that writes the line of an answered request.
30#[derive(Clone, Copy, Debug, Default)]
31#[hyperlane::response_middleware(100)]
32pub struct ResponseLogger;