deslog 0.2.0

D Extended Set Logging System

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

D Extended Set (DES) Logging System

Package provides static Logger logger

Logger using

class Logger has functions for logging with different levels

void error(Args...)( Args args );
void warn (Args...)( Args args );
void info (Args...)( Args args );
void Debug(Args...)( Args args );
void trace(Args...)( Args args );

and for hacking logging system in runtime

static shared(OutputHandler) output() @property;
static shared(Rule) rule() @property;

For hacking see example dir

Simple example

import des.log;

void func()
    logger.fatal( "fatal" );
    logger.error( "error" );
    logger.warn( "warn" ); "info" );
    logger.Debug( "debug" );
    logger.trace( "trace" );

void main()
    logger.fatal( "fatal message" );
    logger.error( "error message" );
    logger.warn( "warn message" ); "info message" );
    logger.Debug( "debug message" );
    logger.trace( "trace message" );


example output

Flag --log used for setting max level of logging output. Default level is error. If log function called with greater level it's skipped. Level has attitudes off < fatal < error < warn < info < debug < trace.

Flag --log can be used with module name ./program --log draw.point:debug. It will set debug level for module draw.point and default to other.

Flag --log-use-min is boolean flag. It forces logging system to skip output from all child modules if their level greater than parent. Default is false.

./program --log trace --log draw:info --log draw.point:trace --log-use-min=true skips all output from logger.trace and logger.Debug from whole draw.point, and doesn't skip from other modules.

./program --log trace --log draw:info --log draw.point:trace allow log_trace and log_debug only from draw.point from module draw. For other modules in draw sets level info

You can compile program with version=des_log_onlyerror for skip all trace, debug, info and warn outputs in logger. It can improve program release speed.

Class logging

Module provides some functional for useful logging classes.


module x;
import des.log;
class A
    mixin ClassLogger;
    void func() { logger.trace( "hello" ); }
module y;
import x;
class B : A { }
auto b = new B;


If create instance logger

class B : A { this(){ logger = new InstanceLogger(this); } }


If create instance logger with instance name

class B : A { this(){ logger = new InstanceLogger(this,"my object"); } }


If create instance full logger

class B : A { this(){ logger = new InstanceFullLogger(this); } }


If create instance full logger with name

class B : A { this(){ logger = new InstanceFullLogger(this,"name"); } }


Flag --log can get full emitter string y.B.[name].[x.A.func].

./program --log "y.B.[one]:trace" --log "y.B.[two]:debug"

Documentation orient to harbored-mod

to build doc:

cd path/to/desstdx
  • Oleg Butko (deviator)
0.3.0 2015-Dec-12
0.2.1 2015-Dec-08
0.2.0 2015-May-30
~master 2015-Dec-12
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 424 downloads total

Short URL: