Class: SemanticLoggerJournald::Appender
- Inherits:
-
SemanticLogger::Subscriber
- Object
- SemanticLogger::Subscriber
- SemanticLoggerJournald::Appender
- Defined in:
- lib/semantic_logger_journald/appender.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger: nil, syslog_id: nil, **args, &block) ⇒ Appender
constructor
A new instance of Appender.
- #log(log) ⇒ Object
Constructor Details
#initialize(logger: nil, syslog_id: nil, **args, &block) ⇒ Appender
Returns a new instance of Appender.
9 10 11 12 |
# File 'lib/semantic_logger_journald/appender.rb', line 9 def initialize(logger: nil, syslog_id: nil, **args, &block) @logger = logger || Journald::Logger.new(syslog_id) super(**args, &block) end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/semantic_logger_journald/appender.rb', line 7 def logger @logger end |
Instance Method Details
#log(log) ⇒ Object
14 15 16 |
# File 'lib/semantic_logger_journald/appender.rb', line 14 def log(log) @logger.(formatter.call(log, self)) end |