Class: Makit::Logging::StructuredFormatter Deprecated
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Makit::Logging::StructuredFormatter
- Defined in:
- lib/makit/logging.rb
Overview
Deprecated.
This class is deprecated and will be removed in version 0.2.0. Use Makit::Logging::Logger with Makit::Logging::Sinks::FileSink (formatter: :json) instead.
Structured JSON log formatter
This formatter outputs log messages as JSON objects with structured fields including timestamp, level, message, and program name. Useful for log aggregation systems and machine parsing.
Instance Method Summary collapse
-
#call(severity, time, progname, msg) ⇒ String
Format a log message as JSON.
Instance Method Details
#call(severity, time, progname, msg) ⇒ String
Format a log message as JSON
196 197 198 199 200 201 202 203 204 205 |
# File 'lib/makit/logging.rb', line 196 def call(severity, time, progname, msg) warn "Makit::Logging::StructuredFormatter is deprecated and will be removed in version 0.2.0. Use Makit::Logging::Logger with Makit::Logging::Sinks::FileSink (formatter: :json) instead." = time.strftime("%Y-%m-%d %H:%M:%S.%L") { timestamp: , level: severity, message: msg, progname: progname, }.to_json + "\n" end |