Implementing std.log

Andrew Wiley wiley.andrew.j at gmail.com
Sat May 7 14:55:45 PDT 2011


On Sat, May 7, 2011 at 4:17 PM, Jose Armando Garcia <jsancio at gmail.com>wrote:

> Hey folks,
>
> For the past couple of days I took the liberty of partially
> implementing a logging module for D. I say partially because all the
> features that I want to implement are not currently implement. You
> should really look at the implementation more as a proof of concept
> even thought most of the code will be used in the final
> implementation.
>
> That been said I am really interested in getting some feedback on the
> API. That includes high-level design (e.g. using a thread to perform
> logging. On that note I am planning to also have a shared memory
> implementation), interfaces and the documentation.
>
> When making comment be aware that the design goals of the module are:
> 1) Provide a logging mechanism that is easy to use in the common case.
> 2) The module should allow for as much configuration as possible at
> compile time and execution time without breaking design goal 1.
> 3) It should be possible to extend or replace the backend without
> breaking the semantic exposed by the API.
>
> I am fairly new to the D language so any comment on how I can take
> advantage of D idiom or D features in the API or implementation would
> be greatly appreciated.
>
> My intent, and hopefully we will get there with your help, is to
> include this in Phobos for D2.
>
> logging.d - http://ubuntuone.com/p/rfL/
> logging.html - http://ubuntuone.com/p/rfM/
>
> Thanks,
> -Jose
>


I'll be sure to try it out in the next few days. Passing messages to a
separate logging thread seems like it might be a overkill, but it could
work. I do like that you can get the file and line included with messages.
One thing I'll miss from Log4J and its siblings is that typing
log.info("message")
is a lot more intuitive than log(LogLevel.info, "message"). I don't think
that's a major gripe though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110507/20518804/attachment.html>


More information about the Digitalmars-d mailing list