Description

Log library by D

Package Information

Version1.2.1-rc3 (2016-Aug-10)
Repositoryhttps://github.com/nykytenko/onyx-log
LicenseMIT
CopyrightCopyright © 2014-2015
AuthorsOleg Nykytenko
Registered byOleg Nykytenko
Dependencies

onyx-config

Installation

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

dub.json
dub.sdl

Readme

onyx-log

onyx-log: the simple, fast, multithreading logging library for D.

Key features:

  • Create loggers in "logger pool" with configuration data packed to ConfBundle (onyx-config lib).
  • Get logger by his name.
  • Write message to logger.
  • Any work with loggers in multi-threaded environment is safety.

Examples:

Configuration text file ("./test/test.conf"):

# Logger's name. Any string value
[DebugLogger] 				

# Message level accepted by logger
# Values by priority from low to high: debug, info, warning, error, critical, fatal
level = debug			

# Appender is logger's message writer
# Values: NullAppender, ConsoleAppender, FileAppender
appender = FileAppender

# Rolling type
# Values: SizeBasedRollover
rolling = SizeBasedRollover

# Log file max size
# Values: number, number with suffix: K, M, G, T, P
maxSize = 2K

# Max number of log files
# Values: number
maxHistory = 4

# For FileAppender need path to log file and base of file name
fileNameBase = ./log/MainDebug.log



[ErrorLogger]
level = error
appender = ConsoleAppender


Source code example:

import onyx.log;
import onyx.config.bundle;

void main()
{
	/* Build ConfBundle from config file */
	auto bundle = immutable ConfBundle("./test/test.conf");

	/* Add loggers to "logger pool" */
	createLoggers(bundle);

	/* Get logger from "logger pool" */
	auto log = getLogger("ErrorLogger");

	/* send message to logger */
	log.error("error msg");

	auto logDebug = getLogger("DebugLogger");
	logDebug.debug_("debug msg");
	logDebug.info("info msg");
	logDebug.error("error!!!!!! msg");
}

Available versions

1.2.1-rc3 1.2.1-rc2 1.2.1-rc1 1.2.0-beta.1 1.1.0-beta.7 1.1.0-beta.6 1.1.0-beta.5 1.1.0-beta.4 1.1.0-beta.3 1.0.0-beta.2 1.0.0-beta.1 0.0.1-dev.1 ~master ~dev