A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/NLog/NLog/wiki/CsvLayout below:

CsvLayout · NLog/NLog Wiki · GitHub

A specialized layout that renders CSV-formatted events.

Platforms Supported: All

<targets>
  <target>
    <layout xsi:type="CsvLayout">
      <!-- CSV Columns -->
      <column layout="Layout" name="String"/> <!-- repeated -->

      <!-- CSV Options -->
      <quoting>Enum</quoting>
      <quoteChar>String</quoteChar>
      <withHeader>Boolean</withHeader>
      <customColumnDelimiter>String</customColumnDelimiter>
      <delimiter>Enum</delimiter>
    </layout>
  </target>
</targets>

Array-collection where each item is represented by <column /> element with the following attributes:

<target xsi:type="File" name="csvFileExample" fileName="./CsvLogExample.csv">
    <layout xsi:type="CsvLayout" delimiter="Tab" withHeader="false">
        <column name="time" layout="${longdate}" />
        <column name="level" layout="${level:upperCase=true}"/>
        <column name="message" layout="${message}" />
        <column name="exception" layout="${exception:format=ToString}"/>
        <column name="property1" layout="${event-properties:property1}"/>
    </layout>
</target>

NLog 4.6 introduces some performance optimizations for the CsvLayout. Reducing memory allocation by better buffer reuse. It is also possible to reduce the overhead of the automatic quoting logic for individual columns:

This is example will greatly reduce the overhead of default Auto-quoting, because of the override for the individual columns:

    <layout xsi:type="CsvLayout" delimiter="Tab" withHeader="false">
        <column name="time" layout="${longdate}" quoting="Nothing" />
        <column name="level" layout="${level:upperCase=true}" quoting="Nothing"/>
        <column name="message" layout="${message}" quoting="All" />
        <column name="exception" layout="${exception:format=ToString}" quoting="All"/>
        <column name="property1" layout="${event-properties:property1}"/>
    </layout>
Layout = new CsvLayout()
{
   Columns =
   {
      new CsvColumn("time", "${longdate}"),
      new CsvColumn("level", "${level:upperCase=true}"),
      new CsvColumn("message", "${message}"),
      new CsvColumn("exception", "${exception:format=ToString}"),
      new CsvColumn("property1", "${event-properties:property1}"),
   }
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4