Class: Onlylogs::Formatter
- Inherits:
-
ActiveSupport::Logger::SimpleFormatter
- Object
- ActiveSupport::Logger::SimpleFormatter
- Onlylogs::Formatter
- Includes:
- ActiveSupport::TaggedLogging::Formatter
- Defined in:
- lib/onlylogs/formatter.rb
Instance Attribute Summary collapse
-
#denylist ⇒ Object
Returns the value of attribute denylist.
Instance Method Summary collapse
- #call(severity, time, progname, msg) ⇒ Object
-
#initialize ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize ⇒ Formatter
Returns a new instance of Formatter.
7 8 9 10 |
# File 'lib/onlylogs/formatter.rb', line 7 def initialize super @denylist = [] end |
Instance Attribute Details
#denylist ⇒ Object
Returns the value of attribute denylist.
5 6 7 |
# File 'lib/onlylogs/formatter.rb', line 5 def denylist @denylist end |
Instance Method Details
#call(severity, time, progname, msg) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/onlylogs/formatter.rb', line 12 def call(severity, time, progname, msg) return nil if "Onlylogs::LogsChannel".in?(msg) return nil if denylist.any? { |pattern| pattern.match?(msg) } = [time.iso8601, severity[0].upcase] str = super .size str end |