Powered by SmartDoc

Logging

CKLog is a simple logging class with 5 debug levels, It writes log messages higher than setted level. The debug level is gDEBUG < INFO < WARN < ERROR < FATALh.

Logging methods
Method Description
debug(message) Write messageon DEBUG level.
info(message) Write messageon INFO level.
warn(message) Write messageon WARN level.
error(message) Write messageon ERROR level.
fatal(message) Write messageon FATAL level.

Options

Logging options are the following. Use log_optionsattribute of CKApplication to initialize CKLog objects instead of setting each options to do directly.

Options
Option Description
level Debug level.
name Program name.
out Output. By default is standard error.
file File name to output logs. Set this or outoption.
max_file_size Max file size (this enables if you set file to output). If size of the file is over this size, FileSizeErroris raised.
options = {elevelf         => CKLog::DEBUG,
           enamef          => eCGIKit Applicationf,
           efilef          => elog.txtf,
           emax_file_sizef => 1000000}

app = CKApplication.new
app.log_options = options
app.run
class MainPage < CKComponent
  def logging
    log = CKLog.new(application.log_options)
    log.debug elog messagef
  end
end