Implementing std.log

Jonathan M Davis jmdavisProg at gmx.com
Sun May 8 02:09:50 PDT 2011


> On Sat, May 7, 2011 at 11:03 PM, dsimcha <dsimcha at yahoo.com> wrote:
> > Ok, there's clearly been some misunderstanding here.  My real point was,
> > why do you need this threading at all?
> 
> It's definitely overkill for a single threaded application, but for things
> like the application I'm working on, which is multithreaded and already
> uses message passing between threads, I think it would fit in quite
> nicely. My question would be whether it's pluggable enough to allow the
> simple case of a single threaded program that doesn't need message passing
> to be implemented.

Honestly, I would hope that whatever the logging did with threads would be 
entirely internal and invisible. At most, the logger should indicate which 
thread the log message came from. How it's thread safe should be invisible and 
irrelevant to anyone using the logger. Why should I care whether it's using 
message passing, shared variables, or whatever internally? Ideally, it 
wouldn't need to worry about threading at all, but I'm not sure how likely 
that is. I believe that writeln should be thread-safe, but I'm not sure that 
file stuff would be, and presumably the logger needs to be able to do both of 
those.

- Jonathan M Davis


More information about the Digitalmars-d mailing list