Class: Fluent::Logger::TextLogger
- Inherits:
-
LoggerBase
- Object
- LoggerBase
- Fluent::Logger::TextLogger
- Defined in:
- lib/fluent/logger/text_logger.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize ⇒ TextLogger
constructor
A new instance of TextLogger.
- #post_with_time(tag, map, time) ⇒ Object
Methods inherited from LoggerBase
Constructor Details
#initialize ⇒ TextLogger
Returns a new instance of TextLogger.
22 23 24 25 |
# File 'lib/fluent/logger/text_logger.rb', line 22 def initialize require 'yajl' @time_format = "%b %e %H:%M:%S" end |
Instance Method Details
#post_with_time(tag, map, time) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/fluent/logger/text_logger.rb', line 27 def post_with_time(tag, map, time) a = [time.strftime(@time_format), " ", tag, ":"] map.each_pair {|k,v| a << " #{k}=" a << Yajl::Encoder.encode(v) } post_text a.join true end |