Implementing std.log

Jens Mueller jens.k.mueller at gmx.de
Mon May 16 13:52:02 PDT 2011


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.

I started to test it out.
Some things to consider:
* If I miss a minus on a program option that option will be silently
  missed.
  E.g. I wrote -minloglevel 0 instead of --minloglevel 0 and was quite
  puzzled that I didn't get all messages.
* Rename TEST_TMPDIR to LOG_TMPDIR or LOG_DIR?
* I believe printing a ulong as thread id is too wasteful and makes the
  output harder to read.
* I would arrange the loggers in increasing order of importance in the
  documentation (and source), i.e. logInfo, logWarning, ...
  And at very last: vlog.
  In the same order as done in the synopsis.
* I'm unsure whether the logging levels should better be implemented
  using enum instead of dchars[]. Because 'I', 'W', 'E', 'C', 'F' are
  used several times in the source.
* Instead of logInfo, logWarning, logError etc. just naming them info,
  warn, error etc. may be an option. I think it's quite obvious that
  these are logging statements. No need for the prefix log?
* Even though vlog is short maybe logVerbose is more consistent. But
  admittedly it's quite long.

I'm trying to read linker map files to evaluate how much code is
generated when using the strip_log_* version options. Is there some good
documentation on how to read those files?
I believe I will have to read some basic literature about linker and
loaders.

Jens


More information about the Digitalmars-d mailing list