Iterating zapcore.EntryCaller #1284
ducknificient
started this conversation in
General
Replies: 1 comment
-
@ducknificient I think you're looking for the AddStacktrace option. It'll print a stack trace for all log messages at and above a certain level. Note that capturing a stacktrace isn't cheap, so you should only do it for log levels where it's important to have a stack trace: error and above. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure if this a Q&A, but i think it contains a lot of discussions. I have this runtime.calller code
the code print complete caller information. Can i achieve same result using zap ? my log already shown caller, but it's only main. AFAIK the only know to shown caller is by using AddCallerSkip(), but this is not flexible because we need to hardcode it
{"level":"info","date":"2023-05-11 09:55:46","caller":"gitlogger.go:107","message":"App listening on localhost:8090"}
Beta Was this translation helpful? Give feedback.
All reactions