Description

The Graylog Extended Log Format for std.experimental.logger

Package Information

Version0.1.1 (2016-Apr-01)
Repositoryhttps://github.com/kaleidicpublic/gelf
LicenseBSL-1.0
CopyrightCopyright © 2016, Ilya Yaroshenko
AuthorsIlya Yaroshenko
Registered byIlya Yaroshenko
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

gelf

Implementation of Graylog Extended Logging Format for std.experimental.logger.

Features

  • Small and flexible API
  • GrayLogger does not throw exceptions while it is sending a message
  • UDP, TCP, and HTTP transports are supproted

Examples

UDP

Compress c; //use `null` value is for no compression
// c = new Compress;
// c = new Compress(HeaderFormat.gzip);
auto socket = new UdpSocket();
socket.connect(new InternetAddress("192.168.59.103", 12201));
// The last param is UDP chunk size. This is optional paramter with default value equals to 8192
sharedLog = new UdpGrayLogger(socket, c, "YourServiceName", LogLevel.all, 4096);

error("===== Error Information =====");

TCP

import std.typecons: Yes, No;
auto socket = new TcpSocket();
socket.connect(new InternetAddress("192.168.59.103", 12201));
/+Defualt value for nullDelimeter is `Yes`. Newline delimiter would be used if nullDelimeter is `false`/`No`.+/
sharedLog = new TcpGrayLogger(socket, "YourServiceName", LogLevel.all, Yes.nullDelimeter);

error("===== Error Information =====");

HTTP

import std.net.curl: HTTP;
Compress c; //use `null` value is for no compression
// c = new Compress;
// c = new Compress(HeaderFormat.gzip);
sharedLog = new HttpGrayLogger(HTTP("192.168.59.103:12204/gelf"), c, "YourServiceName", LogLevel.all);

error("===== Error Information =====");

Available versions

0.1.1 0.1.0 ~master