lib/fluent/plugin/out_mail.rb in fluent-plugin-mail-0.0.4 vs lib/fluent/plugin/out_mail.rb in fluent-plugin-mail-0.0.5
- old
+ new
@@ -1,8 +1,13 @@
class Fluent::MailOutput < Fluent::Output
Fluent::Plugin.register_output('mail', self)
+ # Define `log` method for v0.10.42 or earlier
+ unless method_defined?(:log)
+ define_method("log") { $log }
+ end
+
config_param :out_keys, :string, :default => ""
config_param :message, :string, :default => nil
config_param :message_out_keys, :string, :default => ""
config_param :time_key, :string, :default => nil
config_param :time_format, :string, :default => nil
@@ -86,10 +91,10 @@
messages.each_with_index do |msg, i|
subject = subjects[i]
begin
res = sendmail(subject, msg)
rescue
- $log.warn "out_mail: failed to send notice to #{@host}:#{@port}, subject: #{subject}, message: #{msg}"
+ log.warn "out_mail: failed to send notice to #{@host}:#{@port}, subject: #{subject}, message: #{msg}"
end
end
chain.next
end