ALEOS AF API Reference Guide
- Apr 5, 2012
- Author: Sierra Wireless
This provides detailed API documentation of all the Lua modules in ALEOS AF.
Log library provides logging facilities.
The module exposes extension points. It is possible to provide both the custom printing function and the custom log saving function.
The module is callable. Thus:
Type
Type
Type
#number
7
#number
6
#number
5
#number
2
#number
4
#number
1
#number
3
Type
#levels
Default verbosity level.
Default value is 'WARNING'.
Default logger for instant display.
This logger can be replaced by a custom function.
It is called only if the log needs to be traced.
#string
Format is a string used to apply specific formating before the log is outputted.
Within a format, the following tokens are available (in addition to standard text)
Per module verbosity levels.
Determines whether a log must be traced depending on its severity and the module.
issuing the log.
Sets the log level for a list of module names.
If no module name is given, the default log level is affected
Logger function for log storage.
This logger can be replaced by a custom function.
There is no default logger.
It is called only if the log needs to be traced (see #log.musttrace) and after the log has been displayed using {displaylogger}.
Prints out a log entry according to the module and the severity of the log entry.
This function uses #log.format and #log.timestampformat to create the final message string.
It calls #log.displaylogger and #log.storelogger.
The module exposes extension points. It is possible to provide both the custom printing function and the custom log saving function.
The module is callable. Thus:
local log = require"log"
log("MODULE", "INFO", "message")
calls the #log.trace function.
Type levels
| levels.ALL | 7 |
| levels.DEBUG | 6 |
| levels.DETAIL | 5 |
| levels.ERROR | 2 |
| levels.INFO | 4 |
| levels.NONE | 1 |
| levels.WARNING | 3 |
Type log
| log.defaultlevel | Default verbosity level. |
| log.displaylogger(severity, msg) | Default logger for instant display. |
| log.format | Format is a string used to apply specific formating before the log is outputted. |
| log.modules | Per module verbosity levels. |
| log.musttrace(severity) | Determines whether a log must be traced depending on its severity and the module. |
| log.setlevel(slevel, varargs) | Sets the log level for a list of module names. |
| log.storelogger(severity, msg) | Logger function for log storage. |
| log.trace(severity, fmt) | Prints out a log entry according to the module and the severity of the log entry. |
Type levels
Severity name <-> Severity numeric value translation table.
Built-in values (in order from the least verbose to the most):
Field(s)
#number
levels.ALL
7
#number
levels.DEBUG
6
#number
levels.DETAIL
5
#number
levels.ERROR
2
#number
levels.INFO
4
#number
levels.NONE
1
#number
levels.WARNING
3
Type log
Field(s)
#levels
log.defaultlevel
Default verbosity level.
Default value is 'WARNING'.
log.displaylogger(severity, msg)
Default logger for instant display.
This logger can be replaced by a custom function.
It is called only if the log needs to be traced.
Parameters
-
severity: string representing the log level. -
msg: string containing the message to log.
#string
log.format
Format is a string used to apply specific formating before the log is outputted.
Within a format, the following tokens are available (in addition to standard text)
log.modules
Per module verbosity levels.
log.musttrace(severity)
Determines whether a log must be traced depending on its severity and the module.
issuing the log.
Parameter
-
severity: string representing the log level.
Return values
- `nil' if the message of the given severity by the given module should not be printed.
- true if the message should be printed.
log.setlevel(slevel, varargs)
Sets the log level for a list of module names.
If no module name is given, the default log level is affected
Parameters
-
slevel: level as in #levels -
varargs: Optional list of modules names (string) to apply the level to.
Return value
nothing.
log.storelogger(severity, msg)
Logger function for log storage.
This logger can be replaced by a custom function.
There is no default logger.
It is called only if the log needs to be traced (see #log.musttrace) and after the log has been displayed using {displaylogger}.
Parameters
-
severity: string representing the log level. -
msg: string containing the message to log.
log.trace(severity, fmt)
Prints out a log entry according to the module and the severity of the log entry.
This function uses #log.format and #log.timestampformat to create the final message string.
It calls #log.displaylogger and #log.storelogger.
Parameters
-
severity: string representing the log level. -
fmt: string format that holds the log text the same way as string.format does.
Usage:
trace("MODULE", "INFO", "message=%s", "sometext").Comment
Forum