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_attributesattribute 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 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. |
Logging options are the following. Use log_optionsattribute 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 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 = {?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