Class: RubyLogger
- Inherits:
-
Object
- Object
- RubyLogger
- Defined in:
- lib/debugtrace/loggers.rb
Overview
A logger class that outputs using the logging library.
Defined Under Namespace
Classes: Formatter
Instance Method Summary collapse
-
#initialize(config) ⇒ RubyLogger
constructor
A new instance of RubyLogger.
-
#print(message) ⇒ Object
Outputs the message.
-
#to_s ⇒ String
Returns a string representation of this object.
Constructor Details
#initialize(config) ⇒ RubyLogger
Returns a new instance of RubyLogger.
75 76 77 78 79 80 81 |
# File 'lib/debugtrace/loggers.rb', line 75 def initialize(config) @config = Common::check_type("config", config, Config) @logger = Logger.new( @config.log_path, formatter: Formatter.new(@config), datetime_format: @config.logging_datetime_format) end |
Instance Method Details
#print(message) ⇒ Object
Outputs the message.
85 86 87 88 |
# File 'lib/debugtrace/loggers.rb', line 85 def print() Common::check_type("message", , String) @logger.log(Logger::Severity::DEBUG, , 'DebugTrace-rb') end |
#to_s ⇒ String
Returns a string representation of this object.
92 93 94 |
# File 'lib/debugtrace/loggers.rb', line 92 def to_s "Ruby #{Logger.name} path: #{@config.log_path}" end |