Class: Rumbrl::Grumble

Inherits:
Log
  • Object
show all
Defined in:
lib/rumbrl/grumble.rb

Overview

Behance specific logger

Constant Summary collapse

BASE_DATA_FORMAT =
"CHANNEL='%s' MESSAGE='%s'"
BASE_LOG_FORMAT =
"[%datetime%] LEVEL='%severity%' %message%"

Constants inherited from Log

Log::ALLOWED_METHODS

Instance Attribute Summary

Attributes inherited from Log

#data_format, #logger

Instance Method Summary collapse

Methods inherited from Log

#setup_format

Constructor Details

#initialize(path, age, size) ⇒ Grumble

Returns a new instance of Grumble.



10
11
12
13
# File 'lib/rumbrl/grumble.rb', line 10

def initialize(path, age, size)
  super path, age, size, BASE_DATA_FORMAT, BASE_LOG_FORMAT
  self.datetime_format = '%F %T'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, channel, message, **args) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/rumbrl/grumble.rb', line 15

def method_missing(name, channel, message, **args)
  format = BASE_LOG_FORMAT
  args = Smash.flatten(args)
  args.each do |k, v|
    format += " #{k.to_s.upcase}='#{v.to_s.gsub("'", '"')}'"
  end
  setup_format(format)
  super(*[name, channel, message])
end