https://github.com/fluent/fluent-logger-d
A structured logger for Fluentd (D)
https://github.com/fluent/fluent-logger-d
Last synced: 8 months ago
JSON representation
A structured logger for Fluentd (D)
- Host: GitHub
- URL: https://github.com/fluent/fluent-logger-d
- Owner: fluent
- License: apache-2.0
- Created: 2012-02-12T19:05:31.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2015-04-05T21:16:10.000Z (almost 11 years ago)
- Last Synced: 2025-06-08T16:08:45.684Z (9 months ago)
- Language: JavaScript
- Homepage: http://fluentd.org/
- Size: 374 KB
- Stars: 7
- Watchers: 14
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE.txt
Awesome Lists containing this project
README
# Fluent logger
A structured event logger for Fluent
## Usage
```d
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
* [Web site](http://fluentd.org/)
Fluentd official site
* [Source repository](https://github.com/fluent/fluent-logger-d)
Github repository
## Copyright
AuthorMasahiro Nakagawa
CopyrightCopyright (c) 2012- Masahiro Nakagawa
LicenseApache License, Version 2.0