GC free Writer

Lee Braiden leebraid at gmail.com
Fri Feb 8 13:53:17 PST 2013


On Fri, 08 Feb 2013 16:57:39 +0100, David wrote:
> I am currently implementing a logging module, I want to make logging to
> stderr/stdout/"any file" possible, also during runtime-shutdown (logging
> from dtors)
> 
> Atm it lookes like this:
> 
> ----
> void log(LogLevel level, Args...)(Args args) {
>     string message = format(args);
> 
>     ... pass string to writer
> }
> ---

Will this module be published for others to use?  If so, can I suggest a 
feature?

One thing that's really important with logging, but rarely available, is 
not levels, but code areas.  I believe python, for example, allows you to 
name log sections:

    logger("mainsection.subsection.subsubsection1", "message1")
    logger("mainsection.subsection.subsubsection2", "message2")

and then you can enable, say, everything related to "subsection", but 
then filter out everything in "subsubsection2".

That's really important, when debugging/auditing complex apps, without 
actually wanting to modify the code just to find out what's going on.  
Especially since modifying the code can CHANGE what's going on.


-- 
Lee



More information about the Digitalmars-d-learn mailing list