Nlog

De Banane Atomic
Aller à la navigationAller à la recherche

Links

Console project

Nuget packages

  • NLog.Extensions.Logging
  • Microsoft.Extensions.DependencyInjection
  • Microsoft.Extensions.Configuration.Json

Config file

Be sure to have the config file copied to the output folder while building.
appsettings.json
{
  "NLog": {
    "throwConfigExceptions": true,
    "targets": {
      "async": true,
      "logconsole": {
        "type": "ColoredConsole",
        "layout": "${longdate}|${level}|${message} |${all-event-properties} ${exception:format=tostring}"
      }
    },
    "rules": [
      {
        "logger": "*",
        "minLevel": "Info",
        "writeTo": "logconsole"
      }
    ]
  }
}