Class: RfLogger::LogForNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/rf_logger/log_for_notification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry) ⇒ LogForNotification

Returns a new instance of LogForNotification.



4
5
6
7
8
9
# File 'lib/rf_logger/log_for_notification.rb', line 4

def initialize(entry)
  @actor = entry[:actor]
  @action = entry[:action]
  @metadata = entry[:metadata]
  @level = entry[:level]
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



3
4
5
# File 'lib/rf_logger/log_for_notification.rb', line 3

def level
  @level
end

Instance Method Details

#detailsObject



16
17
18
# File 'lib/rf_logger/log_for_notification.rb', line 16

def details
  YAML.dump @metadata
end

#interpolated_configured_subjectObject



20
21
22
23
24
25
26
27
# File 'lib/rf_logger/log_for_notification.rb', line 20

def interpolated_configured_subject
  if subject = RfLogger.configuration.notification_subject
    %w(actor action level).each do |variable|
      subject = subject.gsub("{{#{variable}}}", instance_variable_get("@#{variable}"))
    end
    subject
  end
end

#subjectObject



11
12
13
14
# File 'lib/rf_logger/log_for_notification.rb', line 11

def subject
  interpolated_configured_subject ||
  "#{@level.upcase}! (#{@actor}/#{@action})"
end