Implementing std.log

Jonathan M Davis jmdavisProg at gmx.com
Sat May 14 15:11:15 PDT 2011


On 2011-05-14 14:50, Andrei Alexandrescu wrote:
> On 05/14/2011 04:31 PM, Jonathan M Davis wrote:
> > On 2011-05-14 12:36, Andrei Alexandrescu wrote:
> >> On 05/14/2011 01:29 PM, dsimcha wrote:
> >>> On 5/14/2011 1:04 PM, Andrei Alexandrescu wrote:
> >>>> On 5/9/11 1:52 AM, Andrei Alexandrescu wrote:
> >>>> [snip]
> >>>> 
> >>>> I updated my std.log draft. Added a lot of features including
> >>>> formatted writing, delayed logging, and a variety of configuration
> >>>> options. Replaced the redundant log.xyz with logXyz. The
> >>>> implementation is getting close to reviewable form.
> >>>> 
> >>>> Documentation:
> >>>> 
> >>>> http://d-programming-language.org/phobos-prerelease/std_log.html
> >>>> 
> >>>> Source:
> >>>> 
> >>>> https://github.com/andralex/phobos
> >>>> 
> >>>> Feedback welcome.
> >>>> 
> >>>> 
> >>>> Thanks,
> >>>> 
> >>>> Andrei
> >>> 
> >>> Overall, I like this library a lot. One comment, though, is that the
> >>> docs should be more explicit about threading issues. I assume it's
> >>> going to be made thread-safe before inclusion in Phobos. Also, is
> >>> there any way to get thread-specific logs instead of having them
> >>> intermingled?
> >> 
> >> Logs will be thread-shared. I haven't seen a need for thread-local logs.
> > 
> > I've dealt with code before where it was critical to know which log
> > messages came from which thread if you had any hope of debugging what
> > was going on.
> 
> Just like glog, std.log outputs the thread ID for each log line. See the
> eighth parameter of
> http://d-programming-language.org/phobos-prerelease/std_log.html#logLinePre
> fix

Ah, good to know. I haven't a had chance to look at it yet, and I'd never even 
heard of glog before you brought it up on the newsgroup, so I'm not 
particularly familiar with how the logging is set up. I just thought that I'd 
share my thoughts on logging separate threads. However, looking at 
logLinePrefix, it looks quite good.

By the way, you should probably add sample strings of what the default format 
strings generate. Deciphering exactly what a formatted string is going to 
generate is a lot harder to do than when seeing an example string that was 
generated from it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list