Class | DataObjects::Logger |
In: |
lib/data_objects/logger.rb
|
Parent: | Object |
Logger taken from Merb :)
To replace an existing logger with a new one:
DataObjects::Logger.set_log(log{String, IO},level{Symbol, String})
Available logging levels are
DataObjects::Logger::{ Fatal, Error, Warn, Info, Debug }
Logging via:
DataObjects.logger.fatal(message<String>) DataObjects.logger.error(message<String>) DataObjects.logger.warn(message<String>) DataObjects.logger.info(message<String>) DataObjects.logger.debug(message<String>)
Flush the buffer to
DataObjects.logger.flush
Remove the current log object
DataObjects.logger.close
To initialize the logger you create a new object, proxies to set_log.
DataObjects::Logger.new(log{String, IO},level{Symbol, String})
Logger will not create the file until something is actually logged This avoids file creation on DataObjects init when it creates the default logger.
Message | = | Struct.new(:query, :start, :duration) | ||
LEVELS | = | { :off => 99999, :fatal => 7, :error => 6, :warn => 4, :info => 3, :debug => 0 |
Ruby (standard) logger levels:
off: absolutely nothing 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 DataObjects::Logger::LEVELS[:off, :fatal, :error, :warn, :info, :debug] |
write_nonblock | -> | write_method |
write | -> | write_method |
push_opened | -> | internal_push |
push_closed | -> | internal_push |
aio | [RW] | Use asynchronous I/O? |
buffer | [R] | Direct access to the buffer |
delimiter | [RW] | delimiter to use between message sections |
level | [R] | a symbol representing the log level from {:off, :fatal, :error, :warn, :info, :debug} |
log | [R] | The name of the log file |
To initialize the logger you create a new object, proxies to set_log.
DataObjects::Logger.new(log{String, IO},level{Symbol, String})
@param log<IO,String> either an IO object or a name of a logfile. @param log_level<String> the message string to be logged @param delimiter<String> delimiter to use between message sections @param log_creation<Boolean> log that the file is being created
Note that the string is discarded if the string‘s log level less than the logger‘s log level.
Note that if the logger is aio capable then the logger will use non-blocking asynchronous writes.
@param level<Fixnum> the logging level as an integer @param string<String> the message string to be logged
To replace an existing logger with a new one:
DataObjects::Logger.set_log(log{String, IO},level{Symbol, String})
@param log<IO,String> either an IO object or a name of a logfile. @param log_level<Symbol> a symbol representing the log level from
{:off, :fatal, :error, :warn, :info, :debug}
@param delimiter<String> delimiter to use between message sections @param log_creation<Boolean> log that the file is being created