2.7.3Class LogChannel

Abstract class receiving log requests from log areas.

Class LogChannel

This class cannot directly instantiated. Calling it directlty will generate a code error.

Methods
formatGets or set the log message formatting setting.
levelGets or set the log level.

Methods

format

Gets or set the log message formatting setting.

LogChannel.format( [format] )
format the new format to set (a string).
ReturnThe current log message format (a string).

The message format is a template string filled with informations from the logging system. Some loggin subsystems (as the MS-Windows Event Logger, or as the Posix SYSLOG system) fill autonomously informations on behalf of the application, while others (file and stream based loggers) require a format to print meaningful informations as the timestamp.

The format string can contain the following escape codes:

- %%: The "%" character.

For example, the pattern "%tt%L (%M)t%m" will print something like


      13:22:18.344   D (testbind)   Debug message from testbind.

The module also provides some standard log format code that can be useful in the most common situations as constants defined at toplevel. They are the following:

- LOGFMT_TRACE: "[%s %M.%f]t%m" -- this is useful for logs meant to trace application progress and perform debug sessions. It indicates how many seconds and fractions have passed and the function calling sending the log message.

- LOGFMT_ERROR: "%Tt%L%Ct[%a]t%m" -- this format indicates the complete date and time at which an error took place, the error level and code (padded to 5 digits), the area that generated this error and the message.

- LOGFMT_ERRORP: "%Tt%L%Ct[%a:%M.%f]t%m" -- This format is the same as LOGFMT_ERROR, but it adds the name of the module and function that generated the log to the area description.

- LOGFMT_ERRORT: "%Tt%L%Ct[%M.%f]t%m" -- This format is the same as LOGFMT_ERRORP, but it doesn't report the log area generating the log. Useful if you know that you will be using the general area only.

- LOGFMT_ENTRY: "%Tt(%L) %m" -- Simpler format, reporting the day and time in which a log entry is generated, the log level and the message.

- LOGFMT_ENTRYP: "%Tt(%L) [%a]%m" -- Like LOGFMT_ENTRY, but reporting also the log area.

level

Gets or set the log level.

LogChannel.level( [level] )
level a new log level to be set.
ReturnThe current log level.
Made with http://www.falconpl.org