When an error with level panic occurs, it does not print the stack trace. It still appears in the terminal output, but is not written in the file.
{"timestamp":"2023-12-09T13:56:15.436815815+02:00","level":"ERROR","message":"Response: 500 Server Error - interface conversion: error is *fmt.wrapError, not *app_error.ApplicationError","service":"app-logger","httpRequest":{"url":"http://localhost:8000/api/v1/hotels","method":"GET","path":"/api/v1/hotels","remoteIP":"[::1]:50340","proto":"HTTP/1.1","requestID":"stepan-ThinkPad-L15-Gen-2/f8pOxWi02A-000002"},"stacktrace":"#","panic":"interface conversion: error is *fmt.wrapError, not *app_error.ApplicationError","httpResponse":{"status":500,"bytes":0,"elapsed":1.042674,"body":""}}
I examined a bit and it seems that the l.Options are not the same that we passed to httplog.NewLogger function. They come from RequestLoggerEntry struct, not from Logger struct.
When an error with level panic occurs, it does not print the stack trace. It still appears in the terminal output, but is not written in the file.
In httplog.go file there is this function:
I examined a bit and it seems that the
l.Options
are not the same that we passed tohttplog.NewLogger
function. They come fromRequestLoggerEntry
struct, not fromLogger
struct.Is there a way to enable it that I don't know?