Logger for D (was: Using glog's design for Phobos?)

sybrandy sybrandy at gmail.com
Fri Aug 27 18:18:52 PDT 2010


Here's my current version of the logger.  All of the documentation
should be in the logger.d file.  I also provided a sample config file
(logger.conf) and a sample test file that I was using for benchmarking
(main.d).  Let me know if you have any questions.  Feedback on improving
this is also welcome.

The one thing I forgot to note in here is that the function that writes
to the log is passed into the second version of the constructor, which
needs to be used only once in the code.  A simple log writer is included
at the bottom of logger.d that does work.  The reason I did this was
when I initially asked for feedback, I got several ideas on how the
logger can be improved.  Also, I discussed this with a friend of mine
who stated that people may want to log to something other than a file,
such as syslog.  So, instead of trying to make the one "end all be all"
logger, I felt that by allowing it to accept a function as a parameter
to the constructor, the person can write to any type of log file,
database, whatever they want and the logger interface works the same no
matter what.

There currently is a bug somewhere that I don't understand.  Even though
I have "OwnerTerminated" as part of my receive statement, I still see
exceptions when the program closes.  However, it doesn't seem to affect
the execution of the logger.

Enjoy.

Casey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logger.zip
Type: application/zip
Size: 3194 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100827/faa9dd1c/attachment.zip>


More information about the Digitalmars-d mailing list