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.
21 22 23 24 |
# File 'lib/fluent/logger/text_logger.rb', line 21 def initialize require 'json' @time_format = "%b %e %H:%M:%S" end |
Instance Method Details
#post_with_time(tag, map, time) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/fluent/logger/text_logger.rb', line 26 def post_with_time(tag, map, time) a = [time.strftime(@time_format), " ", tag, ":"] map.each_pair { |k,v| a << " #{k}=" a << JSON.dump(v) } post_text a.join true end |