GithubHelp home page GithubHelp logo

fluent-logger-csharp's Introduction

fluent-logger-csharp / Common.Logging.Fluent

fluent-logger-csharp is a structured logger for Fluentd (C#).

Common.Logging.Fluent is a Common.Logging library bindings for fluent-logger-csharp.

Requirements

.NET Framework 4.5

Dependencies

Installation (in the NuGet Package Manager Console)

fluent-logger-csharp

PM> Install-Package fluent-logger-csharp

Common.Logging.Fluent

PM> Install-Package Common.Logging.Fluent

Usage

fluent-logger-csharp

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

Common.Logging.Fluent

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

Supported types

  • Primitive type, string, DateTime

  • class (public property only)

  • struct

  • Dictionary<string, object>

  • ExpandoObject (public property only)

  • Anonymous type

  • List<>, array

  • does not support cyclic reference

  • does not support null reference

Configuration

Configuration for Fluentd daemon

<source>
  type forward
  port 24224
</source>

<match app.**>
  type stdout
</match>

app.config/web.config for Common.Logging.Fluent

<?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>

License

New BSD License

fluent-logger-csharp's People

Contributors

zoetrope avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.