Class: SemanticLogger::Formatters::Syslog
- Defined in:
- lib/semantic_logger/formatters/syslog.rb
Defined Under Namespace
Classes: LevelMap
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#facility ⇒ Object
Returns the value of attribute facility.
-
#level_map ⇒ Object
Returns the value of attribute level_map.
-
#max_size ⇒ Object
Returns the value of attribute max_size.
Attributes inherited from Base
#log, #log_application, #log_environment, #log_host, #logger, #precision, #time_format
Instance Method Summary collapse
- #call(log, logger) ⇒ Object
-
#initialize(facility: ::Syslog::LOG_USER, level_map: LevelMap.new, max_size: Integer) ⇒ Syslog
constructor
Create a Syslog Log Formatter.
-
#time ⇒ Object
Time is part of the syslog packet and is not included in the formatted message.
Methods inherited from Default
#duration, #exception, #file_name_and_line, #level, #message, #name, #named_tags, #payload, #process_info, #tags, #thread_name
Methods inherited from Base
Constructor Details
#initialize(facility: ::Syslog::LOG_USER, level_map: LevelMap.new, max_size: Integer) ⇒ Syslog
Create a Syslog Log Formatter
Parameters:
facility: [Integer]
Default: ::Syslog::LOG_USER
level_map: [Hash | SemanticLogger::Formatters::Syslog::LevelMap]
Supply a custom map of SemanticLogger levels to syslog levels.
Example:
# Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING.
SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE})
54 55 56 57 58 59 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 54 def initialize(facility: ::Syslog::LOG_USER, level_map: LevelMap.new, max_size: Integer) @facility = facility @level_map = level_map.is_a?(LevelMap) ? level_map : LevelMap.new(level_map) @max_size = max_size super() end |
Instance Attribute Details
#facility ⇒ Object
Returns the value of attribute facility.
11 12 13 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 11 def facility @facility end |
#level_map ⇒ Object
Returns the value of attribute level_map.
11 12 13 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 11 def level_map @level_map end |
#max_size ⇒ Object
Returns the value of attribute max_size.
11 12 13 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 11 def max_size @max_size end |
Instance Method Details
#call(log, logger) ⇒ Object
66 67 68 69 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 66 def call(log, logger) = super(log, logger) create_syslog_packet() end |
#time ⇒ Object
Time is part of the syslog packet and is not included in the formatted message.
62 63 64 |
# File 'lib/semantic_logger/formatters/syslog.rb', line 62 def time nil end |