Singleton for simple logging https://code.dlang.org/packages/singlog
Go to file
Alexander Zhirov df602a8d00 v0.1.0 2023-03-23 12:20:46 +03:00
source v0.1.0 2023-03-23 12:20:46 +03:00
.gitignore v0.1.0 2023-03-23 12:20:46 +03:00
LICENSE v0.1.0 2023-03-23 12:20:46 +03:00
README.md v0.1.0 2023-03-23 12:20:46 +03:00
dub.json v0.1.0 2023-03-23 12:20:46 +03:00
dub.selections.json v0.1.0 2023-03-23 12:20:46 +03:00
dub.settings.json v0.1.0 2023-03-23 12:20:46 +03:00

README.md

singlog

Singleton for simple logging

Basic Usage

import simplog;

void main()
{
    Log.msg.level(Log.DEBUG);
    Log.msg.output(Log.SYSLOG);
    Log.msg.file("./file.log");
    Log.msg.warning("Hello, World!");
}

Examples

Setting the error output level:

Log.msg.level(Log.DEBUG);
Log.msg.level(Log.ALERT);
Log.msg.level(Log.CRIT);
Log.msg.level(Log.ERR);
Log.msg.level(Log.WARNING);
Log.msg.level(Log.NOTICE);
Log.msg.level(Log.INFO);

Assigning a target output:

Log.msg.output(Log.SYSLOG);
Log.msg.output(Log.STDOUT);

Setup and allowing writing to a file:

Log.msg.file("./file.log");
Log.msg.fileOn();
Log.msg.fileOff();

Output of messages to the log:

Log.msg.alert("Alert message");
Log.msg.critical("Critical message");
Log.msg.error("Error message");
Log.msg.warning("Warning message");
Log.msg.notice("Notice message");
Log.msg.informations("Information message");
Log.msg.debugging("Debugging message");

Dub

Add a dependency on "singlog": "~>0.1.0".