Singleton for simple logging
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go to file
Alexander Zhirov 075ccdcdcc Merge pull request 'v0.5.0' (#5) from dev into master
Reviewed-on: #5
2 weeks from now
source v0.5.0 2 weeks from now
tests v0.5.0 2 weeks from now
.gitignore first test 2 months ago v0.5.0 2 weeks from now
LICENSE v0.1.0 4 months ago v0.5.0 2 weeks from now
dub.json fix name program in Windows 4 weeks ago
dub.selections.json v0.1.0 4 months ago
dub.settings.json v0.1.0 4 months ago
logo.png v0.5.0 2 weeks from now
singlog.png release v0.3.0 2 months ago


license main githab dub linux windows

Singleton for simple logging

Basic Usage

import singlog;

void main(string[] argv) {
    log.output(log.output.syslog.stderr.stdout.file)    // write to syslog, standard error/output streams and file
        .program(argv[0])                               // program name as an identifier (for Windows OS)
        .level(log.level.debugging)                     // logging level
        .color(true)                                    // color text output
        .file("./test.log");                            // the path to the log file

    log.i("This is an information message");
    log.n("This is a notice message");
    log.w("This is a warning message");
    log.e("This is an error message");
    log.c("This is a critical message");
    log.a("This is an alert message");
    log.d("This is a debug message");"This error message will only be written to the standard output stream");"This error message will only be written to the syslog and file");




Setting the name of the logged program (it matters for Windows OS):

log.program("My program");

Setting the status of color text output (false by default):


Setting the error output level:


Assigning a target output:


Setup and allowing writing to a file:


Write messages to the log:

log.a("Alert message")          =>    log.alert("Alert message");
log.c("Critical message")       =>    log.critical("Critical message");
log.e("Error message")          =>    log.error("Error message");
log.w("Warning message")        =>    log.warning("Warning message");
log.n("Notice message")         =>    log.notice("Notice message");
log.i("Information message")    =>    log.information("Information message");
log.d("Debugging message")      =>    log.debugging("Debugging message");

Write message to specific outputs:"This error message will only be written to the standard output stream");"This error message will only be written to the syslog and file");


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