- Inheritance
- < Object
- Included Modules
- Logger::Severity
Description
Application — Add logging support to your application.
Usage
- Define your application class as a sub-class of this class.
- Override ‘run’ method in your class to do many things.
- Instantiate it and invoke ‘start’.
Example
class FooApp < Application def initialize(foo_app, application_specific, arguments) super('FooApp') # Name of the application. end def run ... log(WARN, 'warning', 'my_method1') ... @log.error('my_method2') { 'Error!' } ... end end status = FooApp.new(....).start
Attributes
Name | Visibility | R/W | Description |
---|---|---|---|
appname | public | R | |
logdev | public | R |
Methods
Class
Visibility | Signature |
---|---|
public | new (appname = nil) |
Instance
Visibility | Signature |
---|---|
public | level= (level) |
public | log (severity, message = nil, &block) |
public | log= (logdev) |
public | set_log (logdev, shift_age = 0, shift_size = 1024000) |
public | start () |
Class Method Detail
new(appname = nil)
Synopsis
Application.new(appname = '')
Args
appname: | Name of the application. |
Description
Create an instance. Log device is STDERR by default. This can be changed with set_log.
Instance Method Detail
level=(level)
Set the logging threshold, just like Logger#level=.
log(severity, message = nil, &block)
See Logger#add. This application‘s appname is used.
log=(logdev)
set_log(logdev, shift_age = 0, shift_size = 1024000)
start()
Start the application. Return the status code.