fluent-logger 0.1.2

A structured logger for Fluentd.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Fluent logger

A structured event logger for Fluent

Usage

struct Event
{
    string text = "This is D";
    long   id   = 0;
}

// ...
import fluent.logger;

// Create a configuration
FluentLogger.Configuration conf;

// Create a logger with tag prefix and configuration
auto logger = new FluentLogger("app", conf);

// Write Event object with "test" tag to Fluentd 
logger.post("test", Event());

// Disconnect and perform cleanup
logger.close(); // Or destroy(logger);

In this result, Fluentd accepts `{"text":"This is D","id":0}` at "app.test" tag.

Sharing logger

Currently, FluentLogger is not marked as `shared. So, if you share a logger object accross threads, please use __gshared`.

Build

The library: dub build
Documentation: dub build --build=docs
Examples:
   Single-threaded: dub build --config=post-example
   Multi-threaded: dub build --config=post-mt-example

Debug logging:

Limited logging to stdout can be enabled by adding FluentLogger to debugVersions in your project's dub.json:
"debugVersions": ["FluentLogger"],

TODO

  • std.log support after Phobos accepts std.log
  • Add some qualifiers (@safe, nothrow, shared, etc..)
  • Windows support

Fluentd official site

Github repository

<table> <tr>

<td>Author</td><td>Masahiro Nakagawa <[email protected]></td>

</tr> <tr>

<td>Copyright</td><td>Copyright (c) 2012- Masahiro Nakagawa</td>

</tr> <tr>

<td>License</td><td>Apache License, Version 2.0</td>

</tr> </table>

Authors:
  • Masahiro Nakagawa
Dependencies:
msgpack-d
Versions:
0.1.2 2015-Apr-05
0.1.1 2015-Jan-05
0.1.0 2014-Aug-18
~master 2015-Apr-05
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 245 downloads total

Score:
2.1
Short URL:
fluent-logger.dub.pm