Class: StructuredEventLogger::HumanReadableLogger
- Inherits:
-
Object
- Object
- StructuredEventLogger::HumanReadableLogger
- Defined in:
- lib/structured_event_logger/human_readable_logger.rb
Constant Summary collapse
- CLEAR =
"\e[0m"
- BOLD =
"\e[1m"
- MAGENTA =
Colors
"\e[35m"
- CYAN =
"\e[36m"
- WHITE =
"\e[37m"
Instance Attribute Summary collapse
-
#colorize ⇒ Object
Returns the value of attribute colorize.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #call(scope, event, hash, decorated_hash) ⇒ Object
-
#initialize(logger, colorize = ActiveSupport::LogSubscriber.colorize_logging, log_level = nil) ⇒ HumanReadableLogger
constructor
A new instance of HumanReadableLogger.
Constructor Details
#initialize(logger, colorize = ActiveSupport::LogSubscriber.colorize_logging, log_level = nil) ⇒ HumanReadableLogger
Returns a new instance of HumanReadableLogger.
15 16 17 |
# File 'lib/structured_event_logger/human_readable_logger.rb', line 15 def initialize(logger, colorize = ActiveSupport::LogSubscriber.colorize_logging, log_level = nil) @logger, @colorize, @log_level = logger, colorize, log_level end |
Instance Attribute Details
#colorize ⇒ Object
Returns the value of attribute colorize.
13 14 15 |
# File 'lib/structured_event_logger/human_readable_logger.rb', line 13 def colorize @colorize end |
#log_level ⇒ Object
Returns the value of attribute log_level.
13 14 15 |
# File 'lib/structured_event_logger/human_readable_logger.rb', line 13 def log_level @log_level end |
#logger ⇒ Object
Returns the value of attribute logger.
13 14 15 |
# File 'lib/structured_event_logger/human_readable_logger.rb', line 13 def logger @logger end |
Instance Method Details
#call(scope, event, hash, decorated_hash) ⇒ Object
20 21 22 |
# File 'lib/structured_event_logger/human_readable_logger.rb', line 20 def call(scope, event, hash, decorated_hash) logger.add(log_level, format_hash(scope, event, hash)) end |