Class | Ramaze::Logger::RotatingInformer |
In: |
lib/ramaze/log/rotatinginformer.rb
|
Parent: | Object |
base_dir | [R] | |
log_levels | [RW] | |
time_format | [RW] |
Create a new instance of RotatingInformer.
base_dir is the directory where all log files will be stored
time_format is the time format used to name the log files. Possible formats are identical to those accepted by Time.strftime
log_levelse is an array describing what kind of messages that the log receives. The array may contain any or all of the symbols :debug, :error, :info and/or :warn
Examples:
RotatingInformer.new('logs') #=> Creates logs in directory called logs. The generated filenames will be in the form YYYY-MM-DD.log RotatingInformer.new('logs', '%Y-%m.txt') #=> Creates logs in directory called logs. The generated filenames will be in the form YYYY-MM.txt RotatingInformer.new('logs', '%Y-%m.txt', [:error]) #=> Creates logs in directory called logs. The generated filenames will be in the form YYYY-MM.txt. Only errors will be logged to the files.
Set the base directory for log files
If this method is called with the raise_exception parameter set to true the method will raise an exception if the specified directory does not exist or is unwritable.
If raise_exception is set to false, the method will just silently fail if the specified directory does not exist or is unwritable
Takes the prefix (tag), text and timestamp and applies it to the :format trait.