Skip to content

Latest commit

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Tagolog

Tagolog is a free .NET library for structured logging like a breeze. Tagolog libraries are

  • TagologNuGet Version - general tags and tag context support.
  • Tagolog.NLogNuGet Version - adapter for .NET logging library NLog

Getting started

  • Install Tagolog and Tagolog.NLog NuGet packages.
  • Surround your code fragments with tag scopes, fill scopes with structured tags (meta information).
using(vartagScope=TagScopeManager.CreateScope()){scope.Tags["UserId"]="jdoe";scope.Tags["VirtualMachine"]="appserver4.jdoe.tld";// ...log.Info("Stopping virtual machine...");// ...}
  • Modify your application config file append "tagolog" section. app.config example
  • Modify your NLog configuration. NLog.config example
  • Use tagologmdcitem or tagologmdc layout renderers to access your tag values
<targetfileName="${basedir}/${tagologmdcitem:item=Application}.log.txt"name="HumanReadableFile"xsi:type="File"layout="${date:format=HH\:mm\:ss} ${level} ${message}${newline}${tagologmdc:tagKey=#tagKey#:tagValue=#tagValue#:orderBy=true:builtInTags=false:format= [#tagKey#\:#tagValue#]\\n}" />
<targetname="JsonFile"xsi:type="File"fileName="${basedir}/log.json.txt" >
<layoutxsi:type="TagologJsonLayout"SuppressSpaces="True"BuiltInTagsEnabled="True">
<attributename="TimestampLocal"layout="${longdate}" />
....
  • Grab json logs with your business tags to your favourite centralized log storage like Elasticsearch or Graylog

License

Tagolog is open source software, licensed under the terms of BSD license. Tagolog.NLog is open source software, licensed under the terms of BSD license. See license.txt for details.

How to build

Use Visual Studio 2013/2015. Solution files are:

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages