Object
Called after each backup model/trigger has been performed.
# File lib/backup/logger.rb, line 101 def clear! @logger = nil logger.start! end
Allows the Logger to be configured.
# shown with their default values Backup::Logger.configure do # Console options: console.quiet = false # Logfile options: logfile.enabled = true logfile.log_path = 'log' logfile.max_bytes = 500_000 # Syslog options: syslog.enabled = false syslog.ident = 'backup' syslog.options = Syslog::LOG_PID syslog.facility = Syslog::LOG_LOCAL0 syslog.info = Syslog::LOG_INFO syslog.warn = Syslog::LOG_WARNING syslog.error = Syslog::LOG_ERR # Ignore Warnings: # Converts :warn level messages to level :info ignore_warning 'that contains this string' ignore_warning /that matches this regexp/ end
See each Logger’s Option class for details. @see Console::Options @see Logfile::Options @see Syslog::Options
# File lib/backup/logger.rb, line 95 def configure(&block) config.dsl.instance_eval(&block) end
If errors are encountered by Backup::CLI while preparing to perform the backup jobs, this method is called to dump all messages to the console before Backup exits.
# File lib/backup/logger.rb, line 179 def abort! console = Console.new console.log(messages.shift) until messages.empty? end
Returns true if any :error level messages have been received.
# File lib/backup/logger.rb, line 152 def has_errors? @has_errors end
Returns true if any :warn level messages have been received.
# File lib/backup/logger.rb, line 146 def has_warnings? @has_warnings end
The Logger is available as soon as Backup is loaded, and stores all messages it receives. Since the Logger may be configured via the command line and/or the user’s config.rb, no messages are sent until configuration can be completed. (see CLI#perform)
Once configuration is completed, this method is called to activate all enabled loggers and send them any messages that have been received up to this point. From this point onward, these loggers will be sent all messages as soon as they’re received.
# File lib/backup/logger.rb, line 166 def start! @config.loggers.each do |logger| @loggers << logger.class.new(logger.options) if logger.enabled? end messages.each do |message| @loggers.each {|logger| logger.log(message) } end end
Generated with the Darkfish Rdoc Generator 2.