Skip to main content
Version: 2.9.x

How to print the stack of an error variable rather than the stack at the time the log method is called​

Using the following method will only print the string description of the error, and the stack is just the stack at the time the log method Error is called:

g.Log().Error(ctx, err)

If you want to print the stack of the error variable, and not the stack when the Error method is called, you can do it as follows:

g.Log().Printf(ctx, "%+v", err)

Reference links: