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
use ;
use CircularBuffer;
use StyledString;
use Pipe;
/// Pre-defined error message for lock acquisition failures
pub const GET_LOCK_ERR_MSG: &str = "Failed to get static_logs Mutex Lock";
/// Type alias for a ring buffer with fixed capacity storing styled strings.
///
/// Why CircularBuffer?
/// 1. Provides efficient FIFO (a.k.a. First In First Out) behavior with fixed
/// capacity.
/// 2. Automatically overwriting oldest entries when full.
///
/// ⚠️ Important Note
/// - Ensure you call `LogBuffer::boxed()` instead of `LogBuffer::new()` for
/// initialization.
/// - Reason: This data-structure is very large. If allocated on the stack via
/// `new()`, it could cause a stack overflow.
type LogBuffer = ;
/// Thread-safe buffer type breakdown:
/// - Box: Ensures buffer allocation stays on the heap
/// - Mutex: Provides exclusive access synchronization
type SyncBuffer = ;
/// Initializes and provides global access to the thread-safe log buffer
///
/// Why OnceLock? Ensures:
/// 1. Thread-safe lazy initialization
/// 2. Avoids "double initialization" race conditions
/// 3. No unnecessary allocation before first use
pub