Class: Hanami::Logger::Formatter Private
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Hanami::Logger::Formatter
- Includes:
- Utils::ClassAttribute
- Defined in:
- lib/hanami/logger.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Hanami::Logger default formatter. This formatter returns string in key=value format.
Direct Known Subclasses
Constant Summary collapse
- SEPARATOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
' '.freeze
- NEW_LINE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
$/- RESERVED_KEYS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
i(app severity time).freeze
Instance Attribute Summary collapse
- #application_name ⇒ Object private
Class Method Summary collapse
- .eligible?(name) ⇒ Boolean private
- .fabricate(formatter, application_name) ⇒ Object private
- .inherited(subclass) ⇒ Object private
Instance Method Summary collapse
Methods included from Utils::ClassAttribute
Instance Attribute Details
#application_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
148 149 150 |
# File 'lib/hanami/logger.rb', line 148 def application_name @application_name end |
Class Method Details
.eligible?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
138 139 140 |
# File 'lib/hanami/logger.rb', line 138 def self.eligible?(name) name == :default end |
.fabricate(formatter, application_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/hanami/logger.rb', line 120 def self.fabricate(formatter, application_name) case formatter when Symbol (subclasses.find { |s| s.eligible?(formatter) } || self).new when nil new else formatter end.tap { |f| f.application_name = application_name } end |
.inherited(subclass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
132 133 134 135 |
# File 'lib/hanami/logger.rb', line 132 def self.inherited(subclass) super subclasses << subclass end |
Instance Method Details
#call(severity, time, _progname, msg) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
154 155 156 157 158 159 160 161 162 |
# File 'lib/hanami/logger.rb', line 154 def call(severity, time, _progname, msg) _format({ app: application_name, severity: severity, time: time }.merge( (msg) )) end |