std.experimental.logger formal review round 3

Robert burner Schadek via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 5 09:47:37 PDT 2014


On Thursday, 2 October 2014 at 18:11:26 UTC, Marco Leise wrote:
> 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.

I guess that should be part of the Exception. I have no idea how 
to get __FUCTION__ of and Exception from inside another function.

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



More information about the Digitalmars-d mailing list