Class: Maze::Loggers::FileLogger
- Includes:
- Singleton
- Defined in:
- lib/maze/loggers/file_logger.rb
Overview
A logger to file, always logging at TRACE level
Constant Summary collapse
- LOG_LOCATION =
'maze-runner.log'
Instance Attribute Summary collapse
-
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
Attributes inherited from Logger
Instance Method Summary collapse
-
#initialize ⇒ FileLogger
constructor
A new instance of FileLogger.
Methods inherited from Logger
Constructor Details
#initialize ⇒ FileLogger
Returns a new instance of FileLogger.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/maze/loggers/file_logger.rb', line 16 def initialize # Remove the previous log file if it exists File.delete(LOG_LOCATION) if File.exist?(LOG_LOCATION) super(LOG_LOCATION, level: ::Logger::TRACE) @datetime_format = '%H:%M:%S' @formatter = proc do |severity, time, _name, | formatted_time = time.strftime(@datetime_format) "\e[2m[#{formatted_time}]\e[0m #{severity.rjust(5)}: #{}\n" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Maze::Loggers::Logger
Instance Attribute Details
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
14 15 16 |
# File 'lib/maze/loggers/file_logger.rb', line 14 def datetime_format @datetime_format end |