1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/// Default bounded non-blocking log channel capacity for background file writes.
pub const DEFAULT_LOGGER_CHANNEL_CAPACITY: usize = 16_384;
/// Default buffer size in bytes for the background buffered file writer.
pub const LOGGER_FILE_BUFFER_BYTES: usize = 64 * 1024;
/// Background writer thread name.
pub const LOGGER_WRITER_THREAD_NAME: &str = "hyperlane-logger";
/// Debug struct label for [`crate::LoggerConfig`].
pub const DEBUG_LOGGER_CONFIG: &str = "LoggerConfig";
/// Debug field name for log level.
pub const DEBUG_FIELD_LEVEL: &str = "level";
/// Debug field name for output file path.
pub const DEBUG_FIELD_FILE: &str = "file";
/// Debug field name for console flag.
pub const DEBUG_FIELD_CONSOLE: &str = "console";
/// Debug field name for output format.
pub const DEBUG_FIELD_FORMAT: &str = "format";
/// Debug field name for channel capacity.
pub const DEBUG_FIELD_CHANNEL_CAPACITY: &str = "channel_capacity";
/// Debug field name indicating custom sink presence.
pub const DEBUG_FIELD_HAS_SINK: &str = "has_sink";
/// The name of the attribute that carries the moment a request arrived.
pub const ATTRIBUTE_STARTED_AT: &str = "hyperlane-plugin-logger-started-at";
/// The text that stands for a request that carries no path.
pub const PATH_UNKNOWN: &str = "-";
/// The text that stands for a request that carries no method.
pub const METHOD_UNKNOWN: &str = "-";
/// Error reported when the logger configuration was already installed.
pub const ERROR_CONFIG_ALREADY_SET: &str = "the logger configuration was already set";
/// Error reported when the log writer was already installed.
pub const ERROR_FILE_ALREADY_SET: &str = "the log file was already set";
/// Error reported when a global `log` implementation was already installed.
pub const ERROR_LOGGER_ALREADY_INSTALLED: &str = "a logger was already installed";
/// Replacement sequence emitted for carriage returns in log records.
pub const ESCAPED_CR: &str = "\\r";
/// Replacement sequence emitted for line feeds in log records.
pub const ESCAPED_LF: &str = "\\n";
/// Replacement sequence emitted for ANSI escape bytes in log records.
pub const ESCAPED_ESC: &str = "\\x1b";
/// Replacement sequence emitted for double quotes in JSON log records.
pub const ESCAPED_QUOTE: &str = "\\\"";
/// Replacement sequence emitted for backslashes in JSON log records.
pub const ESCAPED_BACKSLASH: &str = "\\\\";
/// Replacement sequence emitted for tabs in JSON log records.
pub const ESCAPED_TAB: &str = "\\t";
/// Prebuilt JSON record prefixes combining `{"level":"<LEVEL>","target":"` for each log level.
pub const JSON_PREFIX_ERROR: &str = "{\"level\":\"ERROR\",\"target\":\"";
/// Prebuilt JSON record prefix for `WARN` records.
pub const JSON_PREFIX_WARN: &str = "{\"level\":\"WARN\",\"target\":\"";
/// Prebuilt JSON record prefix for `INFO` records.
pub const JSON_PREFIX_INFO: &str = "{\"level\":\"INFO\",\"target\":\"";
/// Prebuilt JSON record prefix for `DEBUG` records.
pub const JSON_PREFIX_DEBUG: &str = "{\"level\":\"DEBUG\",\"target\":\"";
/// Prebuilt JSON record prefix for `TRACE` records.
pub const JSON_PREFIX_TRACE: &str = "{\"level\":\"TRACE\",\"target\":\"";
/// Prebuilt plain-text record prefix for `ERROR` records.
pub const PLAIN_PREFIX_ERROR: &str = "ERROR ";
/// Prebuilt plain-text record prefix for `WARN` records.
pub const PLAIN_PREFIX_WARN: &str = "WARN ";
/// Prebuilt plain-text record prefix for `INFO` records.
pub const PLAIN_PREFIX_INFO: &str = "INFO ";
/// Prebuilt plain-text record prefix for `DEBUG` records.
pub const PLAIN_PREFIX_DEBUG: &str = "DEBUG ";
/// Prebuilt plain-text record prefix for `TRACE` records.
pub const PLAIN_PREFIX_TRACE: &str = "TRACE ";
/// JSON record separator between target and message fields.
pub const JSON_SEP_MESSAGE: &str = "\",\"message\":\"";
/// JSON record closing suffix.
pub const JSON_SUFFIX: &str = "\"}";
/// SWAR high-bit mask for 8-byte parallel ASCII classification.
pub const SWAR_HIGH_BITS: u64 = 0x8080_8080_8080_8080;
/// SWAR broadcast of `0x20` for `< 0x20` control byte detection.
pub const SWAR_SPACE_BROADCAST: u64 = 0x2020_2020_2020_2020;
/// SWAR broadcast of `0x01` for exact byte and `0x7f` detection.
pub const SWAR_ONES_BROADCAST: u64 = 0x0101_0101_0101_0101;
/// SWAR broadcast of `b'"'` (`0x22`) for JSON quote detection.
pub const SWAR_QUOTE_BROADCAST: u64 = 0x2222_2222_2222_2222;
/// SWAR broadcast of `b'\\'` (`0x5c`) for JSON backslash detection.
pub const SWAR_BACKSLASH_BROADCAST: u64 = 0x5c5c_5c5c_5c5c_5c5c;
/// ASCII double quote byte (`"`).
pub const ASCII_QUOTE: u8 = b'"';
/// ASCII backslash byte (`\`).
pub const ASCII_BACKSLASH: u8 = b'\\';