Class: Makit::Logging::Sinks::Console
- Inherits:
-
UnifiedFileSink
- Object
- Base
- UnifiedFileSink
- Makit::Logging::Sinks::Console
- Defined in:
- lib/makit/logging/sinks/console.rb
Overview
Console sink for clean, colored log output
This is a thin wrapper around UnifiedFileSink that provides a simple API for console output. It maintains backward compatibility while leveraging the unified logging architecture.
Instance Attribute Summary collapse
-
#format ⇒ Symbol
readonly
The format being used.
Attributes inherited from UnifiedFileSink
Instance Method Summary collapse
-
#config ⇒ Hash
Get sink configuration.
-
#console? ⇒ Boolean
Check if this is a console sink (for compatibility).
-
#initialize(formatter: :console, show_timestamp: false, show_level: false, **formatter_options) ⇒ Console
constructor
Initialize console sink.
Methods inherited from UnifiedFileSink
Methods inherited from Base
Constructor Details
#initialize(formatter: :console, show_timestamp: false, show_level: false, **formatter_options) ⇒ Console
Initialize console sink
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/makit/logging/sinks/console.rb', line 35 def initialize(formatter: :console, show_timestamp: false, show_level: false, **) @format = formatter.to_sym # Build configuration for UnifiedFileSink configuration = { file: $stdout, format: @format, formatter_options: { show_timestamp: , show_level: show_level, }.merge(), } super(configurations: [configuration]) end |
Instance Attribute Details
#format ⇒ Symbol (readonly)
27 28 29 |
# File 'lib/makit/logging/sinks/console.rb', line 27 def format @format end |
Instance Method Details
#config ⇒ Hash
Get sink configuration
54 55 56 57 58 59 60 61 |
# File 'lib/makit/logging/sinks/console.rb', line 54 def config { name: self.class.name.split("::").last, format: @format, colors_enabled: true, unified_sink: true, } end |
#console? ⇒ Boolean
Check if this is a console sink (for compatibility)
66 67 68 |
# File 'lib/makit/logging/sinks/console.rb', line 66 def console? true end |