Applications run on offline-mode when you run them on command-line. Input form data for the applications in ?name=value? format and push Ctrl-D to run.
[localhost:/cgi-bin/Examples] user% ./Examples.cgi (offline mode: enter name=value pairs on standard input) # Ctrl-D Content-Type: text/html <html> <head> <title>Examples</title> </head> <frameset cols="200,*"> <frame name="Index" src="?element_id=IndexPage"> <frame name="Contents" src="?element_id=IntroductionPage"> <noframes> <body> Use other browser. </body> </noframes> </frameset>
If you set true to check_attributes
attribute of CKApplication, CGIKit checks attributes of elements on runtime. It raises errors if nonexistent attributes are setted or required attributes aren?t setted.
CKLog is a simple logging class with 5 debug levels, It writes log messages higher than setted level. The debug level is ?DEBUG < INFO < WARN < ERROR < FATAL?.
Method | Description |
---|---|
debug(message) |
Write message on DEBUG level. |
info(message) |
Write message on INFO level. |
warn(message) |
Write message on WARN level. |
error(message) |
Write message on ERROR level. |
fatal(message) |
Write message on FATAL level. |
Logging options are the following. Use log_options
attribute of CKApplication to initialize CKLog objects instead of setting each options to do directly.
Option | Description |
---|---|
level |
Debug level. |
name |
Program name. |
out |
Output. By default is standard error. |
file |
File name to output logs. Set this or out option. |
max_file_size |
Max file size (this enables if you set file to output). If size of the file is over this size, FileSizeError is raised. |
options = {?level? => CKLog::DEBUG, ?name? => ?CGIKit Application?, ?file? => ?log.txt?, ?max_file_size? => 1000000} app = CKApplication.new app.log_options = options app.run
class MainPage < CKComponent def logging log = CKLog.new(application.log_options) log.debug ?log message? end end