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

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"
      }
    ]
  }
}