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



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

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



14
15
16
17
18
19
# File 'lib/rumbrl/grumble.rb', line 14

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