Review of Jose Armando Garcia Sancio's std.log

Jose Armando Garcia jsancio at gmail.com
Mon Feb 13 18:43:28 PST 2012


On Mon, Feb 13, 2012 at 7:17 PM, Sönke Ludwig
<ludwig at informatik.uni-luebeck.de> wrote:
> Log levels "debug" and maybe also "trace" would be useful, but I see that
> vlog(n)() is meant for that purpose. I would just prefer explicit names
> instead of just numbers.
>
> Is there a compelling reason why formatted logging is not the default? I
> find that most logging calls in practice use formatted output, and the only
> overhead would be searching once through the format string in the case of
> format placeholders.
>
No, no reason. I guess making the opCall an alias to format is better.
That means the concatenate call will be:

log!info.write(...)

Not that great looking. Suggestions?

> A predefined logger for OutputDebugString on Windows would be useful - or
> maybe it could be used instead of stdout at least for non-console
> applications.
>
Never used OutputDebugString. Do you mind sending a patch if std.log
gets commit to phobos? Thanks.

> One kind of log writer that I have in my code is one that outputs a nicely
> formatted HTML file with built-in JavaScript to be able to filter messages
> by priority or module. Maybe this is too much for a standard library
> implementation though.
>
What I would really like is to eventually write a backend logger that
sends the message to elasticsearch. That would make this usable in a
data center environment. For that I first need to extend the
LogMessage class.

> Support for multiple log writers can be useful (e.g. logging to a file +
> logging to stdout or to a log control inside of the running application). Of
> course, one can also simply write a "MultiDispatchLogger"...
>
FileLogger can write to a set of files and/or stderr.

> A format option to log the thread name instead of just the ID.
Good idea.


More information about the Digitalmars-d mailing list