fluent-logger-csharp is a structured logger for Fluentd (C#).
Common.Logging.Fluent is a Common.Logging library bindings for fluent-logger-csharp.
.NET Framework 4.5
fluent-logger-csharp
PM> Install-Package fluent-logger-csharp
Common.Logging.Fluent
PM> Install-Package Common.Logging.Fluent
using
using Fluent;
usage
using (var sender = FluentSender.CreateSync("app").Result)
{
sender.EmitAsync("hoge", new { message = "test" }).Wait();
//Output: [ app.hoge, 2013-02-19T23:01:00+09:00, { "message" : "test" } ]
}
using
using Common.Logging;
using Common.Logging.Fluent;
usage
var properties = new NameValueCollection();
properties["tag"] = "app";
properties["hostname"] = "localhost";
properties["port"] = "24224";
LogManager.Adapter = new FluentLoggerFactoryAdapter(properties);
var logger = LogManager.GetCurrentClassLogger();
logger.Debug("test"); //Output: [ app.TypeName, 2013-02-19T23:01:00+09:00, { "Level" : "DEBUG", "Message" : "test" } ]
-
Primitive type, string, DateTime
-
class (public property only)
-
struct
-
Dictionary<string, object>
-
ExpandoObject (public property only)
-
Anonymous type
-
List<>, array
-
null reference
-
does not support cyclic reference
<source>
type forward
port 24224
</source>
<match app.**>
type stdout
</match>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Fluent.FluentLoggerFactoryAdapter, Common.Logging.Fluent">
<arg key="level" value="DEBUG" />
<arg key="tag" value="app" />
<arg key="hostname" value="localhost" />
<arg key="port" value="24224" />
<arg key="bufmax" value="1048576" />
<arg key="timeout" value="3000" />
<arg key="verbose" value="false" />
<arg key="showLevel" value="true" />
</factoryAdapter>
</logging>
</common>
</configuration>