Skip to content

Predefined formats

dmitrybond edited this page Jul 2, 2012 · 3 revisions

Seelog configuration parser recognizes a set of special format identifiers, known as predefined formats. These identifiers were introduced to avoid creating common formats like 'xml' or 'json' every time explicitly in a configuration file.

Usage

Use one of the predefined format identifiers in 'formatid' attribute of any output node. Predefined ids can be distinguished by a common prefix std:. The full list of ids is given below.

Note: It is absolutely legal to override predefined formats with your own and to create your own formats with identifiers starting with std:, but both practices are not recommended.

Example

Config

<seelog>
    <outputs formatid="std:json">
        <console/>
    </outputs>
</seelog>

Output

seelog.Info("Hello world!"):

{"time":1341218159882230900,"lev":"Inf","msg":"Hello world!"}

List of predefined formats

Full name of a format identifier consists of the prefix std: and one of the identifiers listed below. Here is a full list of id-format pairs:

  • xml-debug: <time>%Ns</time><lev>%Lev</lev><msg>%Msg</msg><path>%RelFile</path><func>%Func</func>
  • xml-debug-short: <t>%Ns</t><l>%l</l><m>%Msg</m><p>%RelFile</p><f>%Func</f>
  • xml: <time>%Ns</time><lev>%Lev</lev><msg>%Msg</msg>
  • xml-short: <t>%Ns</t><l>%l</l><m>%Msg</m>
  • json-debug: {"time":%Ns,"lev":"%Lev","msg":"%Msg","path":"%RelFile","func":"%Func"}
  • json-debug-short: {"t":%Ns,"l":"%Lev","m":"%Msg","p":"%RelFile","f":"%Func"}
  • json: {"time":%Ns,"lev":"%Lev","msg":"%Msg"}
  • json-short: {"t":%Ns,"l":"%Lev","m":"%Msg"}
  • debug: [%LEVEL] %RelFile:%Func %Date %Time %Msg%n
  • debug-short: [%LEVEL] %Date %Time %Msg%n
  • fast: %Ns %l %Msg%n
Clone this wiki locally