[Issue 21751] std.experimental.logger add possibility to pass a throwable to a log

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 21 08:52:28 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=21751

--- Comment #2 from etienne at gitrekt.fr ---
In java for example I can do 
```java
try {
  throw new Exception();
}
catch(Exception e) {
  log.error("This was unexpected", e);
}

And then in my log, I can have the plain exception object to format it in a
particular way. I use this technique to format the log in json and have the
stack trace in a separate field of my json log. This allow me to have my log
analyzer being able to display the message of the error in the main part and if
I expand it, to see the stack trace.

--


More information about the Digitalmars-d-bugs mailing list