Class: FluentLoggerSinatra::Logger
- Inherits:
-
Object
- Object
- FluentLoggerSinatra::Logger
- Defined in:
- lib/fluent-logger-sinatra/logger.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
- #debug(message) ⇒ Object
- #error(message) ⇒ Object
- #fatal(message) ⇒ Object
- #info(message) ⇒ Object
-
#initialize(app, tag, host, port) ⇒ Logger
constructor
A new instance of Logger.
- #warn(message) ⇒ Object
- #write(message) ⇒ Object
Constructor Details
#initialize(app, tag, host, port) ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 8 def initialize(app, tag, host, port) @logger = Fluent::Logger::FluentLogger.new(app, :host => host, :port => port) @tag = tag end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 7 def logger @logger end |
#tag ⇒ Object
Returns the value of attribute tag.
6 7 8 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 6 def tag @tag end |
Instance Method Details
#debug(message) ⇒ Object
12 13 14 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 12 def debug() logger.post(tag, { debug: }) end |
#error(message) ⇒ Object
21 22 23 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 21 def error() logger.post(tag, { error: }) end |
#fatal(message) ⇒ Object
24 25 26 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 24 def fatal() logger.post(tag, { fatal: }) end |
#info(message) ⇒ Object
15 16 17 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 15 def info() logger.post(tag, { info: }) end |
#warn(message) ⇒ Object
18 19 20 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 18 def warn() logger.post(tag, { warn: }) end |
#write(message) ⇒ Object
27 28 29 |
# File 'lib/fluent-logger-sinatra/logger.rb', line 27 def write() logger.post(tag, { write: }) end |