A structured logger for Fluentd (D)
JavaScript D CSS Makefile
Latest commit cf142a9 Apr 6, 2015 @repeatedly repeatedly Merge pull request #6 from davideagen/postdoc
Document Logger's write and post functions.
Permalink
Failed to load latest commit information.
example Use DataBuffer for storage before sending data to Fluent. DataBuffer … Dec 3, 2014
html/candydoc Add example and candydoc Feb 19, 2012
src/fluent Merge pull request #6 from davideagen/postdoc Apr 5, 2015
.gitignore Use DataBuffer for storage before sending data to Fluent. DataBuffer … Dec 3, 2014
LICENSE.txt Add license file Feb 19, 2012
README.markdown Change the stdout debug logging to be done only when the Apr 1, 2015
dub.json Formatted dub.json so that the values line up with each other. Oct 2, 2014
posix.mak

README.markdown

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

Link

Copyright

AuthorMasahiro Nakagawa
CopyrightCopyright (c) 2012- Masahiro Nakagawa
LicenseApache License, Version 2.0