Class: Makit::Logging::Formatters::Base
- Inherits:
-
Object
- Object
- Makit::Logging::Formatters::Base
- Defined in:
- lib/makit/logging/formatters/base.rb
Overview
Base class for all logging formatters
Formatters handle the conversion of log requests into formatted strings that can be written to various outputs (console, files, etc.). This separates formatting concerns from output routing concerns.
Direct Known Subclasses
ConsoleFormatter, JsonFormatter, PlainTextFormatter, TextFormatter
Instance Method Summary collapse
-
#config ⇒ Hash
Get formatter configuration.
-
#format(log_request) ⇒ String
Format a log request into a string.
Instance Method Details
#config ⇒ Hash
Get formatter configuration
30 31 32 33 34 35 |
# File 'lib/makit/logging/formatters/base.rb', line 30 def config { name: self.class.name.split("::").last, type: self.class.name, } end |
#format(log_request) ⇒ String
Format a log request into a string
23 24 25 |
# File 'lib/makit/logging/formatters/base.rb', line 23 def format(log_request) raise NotImplementedError, "Subclasses must implement #format" end |