Class: FPM::Fry::Channel

Inherits:
Cabin::Channel
  • Object
show all
Includes:
Hint
Defined in:
lib/fpm/fry/channel.rb

Overview

A Cabin::Channel with two additional features:

  • There is a new log level ‘hint’ which can point users to improvements.

  • Logging an Exception that responds to #data will merge in the data from this exception. This is used together with WithData

Defined Under Namespace

Modules: Hint

Instance Method Summary collapse

Methods included from Hint

#hint, #hint=, #hint?

Instance Method Details

#_log(message, data = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fpm/fry/channel.rb', line 36

def _log(message, data={})
  case message
  when Hash
    data.merge!(message)
  when Exception
    # message is an exception
    data[:message] = message.to_s
    data[:exception] = message
    data[:backtrace] = message.backtrace
    if message.respond_to? :data
      data = message.data.merge(data)
    end
  else
    data = { :message => message }.merge(data)
  end

  publish(data)
end