Class: Yell::Adapters::Fluentd
- Inherits:
-
Base
- Object
- Base
- Yell::Adapters::Fluentd
- Defined in:
- lib/yell/adapters/fluentd.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#log ⇒ Object
Returns the value of attribute log.
-
#port ⇒ Object
Returns the value of attribute port.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
9 10 11 |
# File 'lib/yell/adapters/fluentd.rb', line 9 def host @host end |
#log ⇒ Object
Returns the value of attribute log.
10 11 12 |
# File 'lib/yell/adapters/fluentd.rb', line 10 def log @log end |
#port ⇒ Object
Returns the value of attribute port.
9 10 11 |
# File 'lib/yell/adapters/fluentd.rb', line 9 def port @port end |
#tag ⇒ Object
Returns the value of attribute tag.
9 10 11 |
# File 'lib/yell/adapters/fluentd.rb', line 9 def tag @tag end |
Instance Method Details
#connect ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/yell/adapters/fluentd.rb', line 47 def connect begin @log ||= Fluent::Logger::FluentLogger.new(nil, :host => (@host || 'localhost'), :port => (@port || 24224)) rescue => e # How do you log an error in the error logger? end end |
#format(*messages) ⇒ Object
55 56 57 58 59 |
# File 'lib/yell/adapters/fluentd.rb', line 55 def format( * ) .inject(Hash.new) do |result, m| result.merge (m) end end |
#to_message(message) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/yell/adapters/fluentd.rb', line 61 def ( ) case when Hash when Exception { "short_message" => "#{.class}: #{.}" }.tap do |m| m.merge!( "long_message" => .backtrace.join("\n") ) if .backtrace end else { "short_message" => .to_s } end end |