Class: Boxlet::Log
- Inherits:
-
Object
- Object
- Boxlet::Log
- Defined in:
- lib/boxlet/log.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
Instance Method Summary collapse
-
#initialize(filename, level, rotation = 10, max_size = 1024000) ⇒ Log
constructor
The levels are: UNKNOWN: An unknown message that should always be logged.
-
#write(level, message) ⇒ Object
Possible levels: (:debug, :info, :warn, :error, :fatal).
Constructor Details
#initialize(filename, level, rotation = 10, max_size = 1024000) ⇒ Log
The levels are:
UNKNOWN: An unknown message that should always be logged.
FATAL: An unhandleable error that results in a program crash.
ERROR: A handleable error condition.
WARN: A warning.
INFO: Generic (useful) information about system operation.
DEBUG: Low-level information for developers.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/boxlet/log.rb', line 17 def initialize(filename, level, rotation=10, max_size=1024000) # create the directory for the log if it doesn't exist if !File.exist? File.dirname(filename) FileUtils.mkdir_p File.dirname(filename) end @log ||= Logger.new(filename, rotation, max_size) @log.level = level @log end |
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
8 9 10 |
# File 'lib/boxlet/log.rb', line 8 def log @log end |