class UU::LoggerFluent
Constants
- NIL
Attributes
formatter[RW]
logger[R]
Public Class Methods
new(cxt, host: ENV['FLUENTD_HOST'], port: ENV['FLUENTD_PORT'])
click to toggle source
# File lib/uu/logger_fluent.rb, line 59 def initialize(cxt, host: ENV['FLUENTD_HOST'], port: ENV['FLUENTD_PORT']) @logger = create_logger(host, port) @formatter = Formatter.new(cxt) end
Public Instance Methods
create_logger(host, port)
click to toggle source
# File lib/uu/logger_fluent.rb, line 64 def create_logger(host, port) return NIL unless host Fluent::Logger::FluentLogger.new( nil, nanosecond_precision: true, host: host, **(port ? { port: port.to_i } : {}) ) end
format_message(severity, message)
click to toggle source
# File lib/uu/logger_fluent.rb, line 77 def format_message(severity, message) @formatter.call(severity, message) end