Module: Fluent::NotifyUtil

Included in:
Plugin::TerminalNotifierFilter, Plugin::TerminalNotifierOutput
Defined in:
lib/fluent/plugin/notify_util.rb

Instance Method Summary collapse

Instance Method Details

#make_option(record) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/fluent/plugin/notify_util.rb', line 11

def make_option(record)
  title = record["title"] || @title
  sub_title = record["sub_title"] || @sub_title
  options = {title: title, subtitle: sub_title}
  unless @activate.empty?
    options.merge!(activate: @activate)
  end
  options
end

#notify(time, record) ⇒ Object



5
6
7
8
9
# File 'lib/fluent/plugin/notify_util.rb', line 5

def notify(time, record)
  message = record["message"] || "#{record.to_json} at #{Time.at(time).localtime}"
  options = make_option(record)
  TerminalNotifier.notify(message, options)
end