Class: UU::LoggerFluent
- Inherits:
-
Object
- Object
- UU::LoggerFluent
- Defined in:
- lib/uu/logger_fluent.rb
Defined Under Namespace
Constant Summary collapse
Class Attribute Summary collapse
-
.cached_logger ⇒ Object
readonly
Returns the value of attribute cached_logger.
Instance Attribute Summary collapse
-
#formatter ⇒ Object
Returns the value of attribute formatter.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #format_message(severity, message) ⇒ Object
-
#initialize(cxt, host: , port: ) ⇒ LoggerFluent
constructor
A new instance of LoggerFluent.
Constructor Details
#initialize(cxt, host: , port: ) ⇒ LoggerFluent
Returns a new instance of LoggerFluent.
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/uu/logger_fluent.rb', line 67 def initialize(cxt, host: ENV['FLUENTD_HOST'], port: ENV['FLUENTD_PORT']) @logger = if host self.class.cached_logger[ { host: host, **(port ? { port: port.to_i } : {}) } ] else NIL end @formatter = Formatter.new(cxt, 'tag') end |
Class Attribute Details
.cached_logger ⇒ Object (readonly)
Returns the value of attribute cached_logger.
64 65 66 |
# File 'lib/uu/logger_fluent.rb', line 64 def cached_logger @cached_logger end |
Instance Attribute Details
#formatter ⇒ Object
Returns the value of attribute formatter.
80 81 82 |
# File 'lib/uu/logger_fluent.rb', line 80 def formatter @formatter end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
79 80 81 |
# File 'lib/uu/logger_fluent.rb', line 79 def logger @logger end |
Instance Method Details
#format_message(severity, message) ⇒ Object
82 83 84 |
# File 'lib/uu/logger_fluent.rb', line 82 def (severity, ) @formatter.call(severity, ) end |