Class: Familia::FamiliaLogger
- Inherits:
-
Logger
- Object
- Logger
- Familia::FamiliaLogger
- Defined in:
- lib/familia/logging.rb
Overview
Custom Logger subclass with TRACE level support.
FamiliaLogger extends Ruby's standard Logger with a TRACE level for extremely detailed debugging output. The TRACE level is numerically equal to DEBUG (0) but distinguishes itself via a thread-local marker that the LogFormatter uses to output 'T' instead of 'D'.
Constant Summary collapse
- TRACE =
TRACE severity level (numerically equal to DEBUG=0).
Uses the same numeric level as DEBUG but signals via thread-local marker to output 'T' prefix instead of 'D'. This approach works around Logger's limitation with negative severity values.
Standard Logger levels: DEBUG=0, INFO=1, WARN=2, ERROR=3, FATAL=4, UNKNOWN=5
0
Instance Method Summary collapse
-
#trace(progname = nil) { ... } ⇒ true
Log a TRACE level message.
Instance Method Details
#trace(progname = nil) { ... } ⇒ true
Sets Fiber[:familia_trace_mode] during execution to signal LogFormatter to output 'T' instead of 'D'
Log a TRACE level message.
This method behaves like the standard Logger methods (debug, info, etc.) but outputs with a 'T' severity letter when used with LogFormatter.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/familia/logging.rb', line 60 def trace(progname = nil, &) # Store marker in thread-local to signal this is TRACE not DEBUG # Track whether we set the flag to avoid clearing it in nested calls was_already_tracing = Fiber[:familia_trace_mode] Fiber[:familia_trace_mode] = true add(TRACE, nil, progname, &) ensure # Only clear the flag if we set it (not already tracing) Fiber[:familia_trace_mode] = false unless was_already_tracing end |