Singleton for simple logging https://code.dlang.org/packages/singlog
Go to file
Alexander Zhirov 3c096f9e5b v0.2.0 2023-03-29 15:53:00 +03:00
source v0.2.0 2023-03-29 15:53:00 +03:00
.gitignore v0.1.0 2023-03-23 12:20:46 +03:00
CHANGELOG.md v0.2.0 2023-03-29 15:53:00 +03:00
LICENSE v0.1.0 2023-03-23 12:20:46 +03:00
README.md v0.2.0 2023-03-29 15:53:00 +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

license main githab dub

Singleton for simple logging

Basic Usage

import simplog;

void main()
{
    log.level(log.DEBUG);
    // write to syslog and file
    log.output(log.SYSLOG | log.FILE);
    log.file("./file.log");
    log.warning("Hello, World!");
}

Examples

Setting the error output level:

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

Assigning a target output:

log.output(log.SYSLOG);
log.output(log.STDOUT);

Setup and allowing writing to a file:

log.output(log.FILE);
log.file("./file.log");

Output of messages to the log:

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

Dub

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