Class: SemanticLoggerJournald::Appender

Inherits:
SemanticLogger::Subscriber
  • Object
show all
Defined in:
lib/semantic_logger_journald/appender.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#loggerObject (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.send_message(formatter.call(log, self))
end