Class: Hanami::Logger::Formatter Private
- Inherits:
-
Logger::Formatter
- Object
- Logger::Formatter
- Hanami::Logger::Formatter
- Includes:
- Utils::ClassAttribute
- Defined in:
- lib/hanami/logger/formatter.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.
" "
- 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
- #colorizer ⇒ Object writeonly private
- #filter ⇒ Object writeonly private
Class Method Summary collapse
- .eligible?(name) ⇒ Boolean private
- .fabricate(formatter, application_name, filters, colorizer) ⇒ 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.
81 82 83 |
# File 'lib/hanami/logger/formatter.rb', line 81 def application_name @application_name end |
#colorizer=(value) ⇒ Object (writeonly)
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.
89 90 91 |
# File 'lib/hanami/logger/formatter.rb', line 89 def colorizer=(value) @colorizer = value end |
#filter=(value) ⇒ Object (writeonly)
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.
85 86 87 |
# File 'lib/hanami/logger/formatter.rb', line 85 def filter=(value) @filter = value 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.
57 58 59 |
# File 'lib/hanami/logger/formatter.rb', line 57 def self.eligible?(name) name == :default end |
.fabricate(formatter, application_name, filters, colorizer) ⇒ 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.
40 41 42 43 44 45 46 47 48 |
# File 'lib/hanami/logger/formatter.rb', line 40 def self.fabricate(formatter, application_name, filters, colorizer) fabricated_formatter = _formatter_instance(formatter) fabricated_formatter.application_name = application_name fabricated_formatter.filter = Filter.new(filters) fabricated_formatter.colorizer = colorizer fabricated_formatter 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.
51 52 53 54 |
# File 'lib/hanami/logger/formatter.rb', line 51 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.
95 96 97 98 99 100 |
# File 'lib/hanami/logger/formatter.rb', line 95 def call(severity, time, progname, msg) colorized = @colorizer.call(application_name, severity, time, progname) colorized.merge!((msg)) _format(colorized) end |