Gambas Documentation - /comp/gb.logging/logger/format

/comp/gb.logging/logger/format

# Logger.Format (gb.logging)

Property Format As String

Sets or returns the format for log messages produced by the Logger object.

The default format is `[$(now)] [$(levelname)] [$(callLocation)] $(message)`.

The format string contains tokens that define which information will be included in the log message. The token literals and their meanings are as follows:

- `$(message)` : Includes the provided message text.

- `$(now)` : Includes the current system date and time.

- `$(callLocation)` : Equivalent to `$(callFile).$(callFunction)$(callLine)`.

- `$(callFile)` : Includes the name of the source code file for the method that invoked the log message construction.

- `$(callLine)` : Includes the source code line in the Gambas program method that invoked the log message construction.

- `$(callFunction)` : Includes the name of the function that invoked the log message construction.

- `$(date)` : Includes the current system date

- `$(time)` : Includes the current system time

- `$(ptimer)` : Includes the process timer value expressed in seconds and subseconds.

- `$(ptimerint)` : includes the process timer value expressed in seconds.

- `$(levelno)` : Includes the message level as an integer.

- `$(levelname)` : Includes the string representation of the message level.

- `$(version)` : Includes the application version.

- `$(gbversion)` : Includes the Gambas runtime version.

- `$(host)` : Includes the system hostname (of the system where the Gambas program is running).

- `$(pid)` : Includes the process id of the task that invoked the log message call.

The tokens are case sensitive. Ensure you used the exact case above.

### Examples

    Dim hLog as new Logger

    hLog.Format="[$(now)] [$(levelname)] [$(callLocation)] $(message)"

would subsequently produce log file message lines similar to the following
`[10/22/2013 17:43:27.388] [INFO] [MTest.Main.11] Starting logger`