std.experimental.logger formal review round 3

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 2 11:20:45 PDT 2014


How would I typically log an exception?
I thought of one line per exception in the chain plus a full
trace for the last exception in the chain.

So the messages would be like:
  Initialization failed.
  Could not load configuration.
  File "~/.config/app/settings.ini" no found.
  Stack trace (outer to inner):
    _Dmain_yadda_yadda+120
    Config.__ctor(…)+312
    …
    File.__ctor(…)+12

So far so good, but I'm stuck at this line of code (where `e`
is a Throwable):

  error(e.msg, e.line, e.file, funcName, prettyFuncName, moduleName);

I don't know how to get at the function and module name where
the exception was thrown. I know this stuff is part of the
symbolic debug information, but I would think it is a common
use case of a logger to log exceptions.

Is it? And if so, what do we want to do about it?

-- 
Marco



More information about the Digitalmars-d mailing list