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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/// Creates a formatted layer with standard configuration options.
///
/// This macro applies consistent formatting settings to any tracing layer,
/// including line numbers, log levels, thread IDs, and target information.
/// ANSI colors are disabled for compatibility with various output destinations.
///
/// # Arguments
///
/// * `$layer` - A tracing layer expression to be configured
///
/// # Returns
///
/// The configured layer with the following settings:
/// - ANSI colors: disabled
/// - Line numbers: enabled
/// - Log levels: enabled
/// - Thread IDs: enabled
/// - Target information: enabled
/// Creates a console logging layer that outputs to stdout.
///
/// This macro conditionally creates a console logging layer based on the enabled flag.
/// When enabled, it creates a formatted layer that writes to stdout with RFC 3339
/// timestamps and applies the specified log level filter.
///
/// # Arguments
///
/// * `$enabled` - Boolean expression indicating whether console logging should be enabled
/// * `$log_level` - Log level filter to apply to the layer
///
/// # Returns
///
/// * `Some(Layer)` - Configured console layer if enabled
/// * `None` - If console logging is disabled
/// Creates a script logging layer for capturing script execution logs in memory.
///
/// This macro conditionally creates a script logging layer that captures log entries
/// in memory for later retrieval. When enabled, it creates a [`ScriptLogHandle`] that
/// implements the tracing [`Layer`] trait and stores log entries in an in-memory buffer.
///
/// # Arguments
///
/// * `$enabled` - Boolean expression indicating whether script logging should be enabled
///
/// # Returns
///
/// * `Some(ScriptLogHandle)` - Configured script log layer if enabled
/// * `None` - If script logging is disabled
/// Creates a syslog logging layer for Unix systems.
///
/// This macro conditionally creates a syslog logging layer based on the enabled flag.
/// When enabled, it initializes a connection to the system's syslog daemon using the
/// `Daemon` facility and includes the process ID in log entries.
///
/// **Platform Support**: Unix-based systems only (Linux, macOS, etc.)
///
/// # Arguments
///
/// * `$enabled` - Boolean expression indicating whether syslog logging should be enabled
/// * `$log_level` - Log level filter to apply to the layer
///
/// # Returns
///
/// * `Some(Layer)` - Configured syslog layer if enabled and initialization succeeds
/// * `None` - If syslog logging is disabled
///
/// # Errors
///
/// Returns [`RexLoggerError::InitializationError`] if:
/// * Failed to create `CString` for syslog identity
/// * Failed to initialize syslog connection