문제

I would like to use ErrorFormat method because it is easer to read, safer and faster. But I also want to log the exception stacktrace.

I tried log.ErrorFormat("My {0} message", "pretty", exception);

But it only logs "My pretty message" Is it possible to use Error/Debug/Info Format in such way?

Thanks.

도움이 되었습니까?

해결책

How about:

log.ErrorFormat("My {0} message: {1}", "pretty", exception);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top