Skip to content

Formatting

goodsign edited this page May 14, 2014 · 13 revisions

The concept

Seelog provides functionality to change format of messages that are sent to byte receivers. Formats are set in 'formats' config section, like this:

<formats>
    <format id="common" format="[%LEV] %Msg"/>
    <format id="critical" format="%Time %Date %RelFile %Func %Msg"/>
    <format id="criticalemail" format="Critical error on our server!\n    %Time %Date %RelFile %Func %Msg \nSent by Seelog"/>
</formats>

Each 'format' node has an 'id' and 'format' attributes. Id is a unique identifier of the format that is used to link format to dispatchers/receivers. The 'format' attribute is used to specify the format string with special formatter objects, starting with '%' symbol. These special symbols are replaced with context values or special strings when message is written to byte receiver.

To check how formats are linked to dispatchers/receivers, check the 'Formatting' part of this section: Dispatchers-and-receivers

List of formatters

Check the Reference.

Predefined formats

Check the Predefined formats section.

Custom formatters

If you need to create your own custom formatters, check the custom formatters section.