Review of Jose Armando Garcia Sancio's std.log

Jose Armando Garcia jsancio at gmail.com
Tue Feb 14 08:19:52 PST 2012


On Tue, Feb 14, 2012 at 5:44 AM, Jacob Carlborg <doob at me.com> wrote:
> On 2012-02-13 22:17, Sönke Ludwig 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.
>>
>> 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.
>>
>> 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.
>
>
> It would be nice to be able to plug in different formatters.
>
What do you mean by formatter? For example the default Logger
(FileLogger) allow you to specify the format line see
FileLogger.Configuration.lineFormat

If you want to do the HTML stuff Sönke mentioned then you need to
inherit Logger and overwrite config.logger. Mind you that the Logger
API should be view almost like a journaling API and HTML is a document
so the differences need to be reconciled in the implementation of
Logger.

Thanks,
-Jose

>
>> 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"...
>>
>> A format option to log the thread name instead of just the ID.
>
>
>
> --
> /Jacob Carlborg


More information about the Digitalmars-d mailing list