-
Notifications
You must be signed in to change notification settings - Fork 7
Different tests log different results #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Having thought about this some more:
|
And then there's this: golang/go#59365 |
@madkins23 Thanks so much for investigating this! I'll get back to you as soon as I'm able to check your comments and reproduce the problem (hopefully in a day or two). |
Sounds good. No particular hurry on my part. I've digressed to building a test harness for You might want check out the In particular, the |
I've constructed my own set of tests of I used your GitHub Actions workflow as a starting point and constructed I'm leaving this issue open for the moment, but I've moved on and you can close whenever you want. |
I started writing a set of tests to compare the output from the
zerolog
handlers I was testing. I wanted to make sure that the different tests were providing the same logging output. I found some things that seemed odd so I expanded that test to all of the other handlers as well.Apparently for some tests the same fields are being configured as "context" as well as data. When the
BenchmarkEventCtxWeak
test runs it generates a handler vianewWithCtx()
which configures the handler with the various test fields. Then the same data is added again vialogEventCtxWeak()
. The result is that some handlers duplicate those fields in the output:I'm not sure if adding the same fields via context and logging is intentional. In any event, some tests are writing twice as much text for half of the tests.
Most of the handlers use
"msg"
for the message field name but a few use"message"
. Thelog/slog
documentation shows a constantMessageKey = "msg"
so it is probably a bug in the handler code for theapex
,logf
,phuslog
, andzerolog
handlers.The
phuslog
handler fails JSON unmarshaling for several reasons:"users"
array ofuser
objects as a string representation."primes"
field (see point 1 above) is likewise turned into a string.user
field fails to make an embedded hash object for the second instance of"user"
:The
apex
logger wraps the attribute fields in an additional object named"fields"
. In addition to using"message"
the time is called"timestamp"
instead of thelog/slog
constantTimeKey = "time"
.The
log15
doesn't use the proper timestamp format (missingZ
). The log level is specified as"lvl"
instead of thelog/slog
constantLevelKey = "level"
.The
logf
handler doesn't generate JSON.Some of these errors suggest bugs in the handlers and I may post them with the appropriate developers. The one that prompted me to write this ticket is the duplicate fields (point 1 above). I'd like to know what is expected (duplicate fields or not) and if the context fields should be different from the attribute fields added later. I am working on adding
log/slog
handlers forzerolog
and I'd like to get them right so that I can see the performance thereof.I'd also like to know if these new tests are of interest. If so I can create an appropriate pull request after I iron out some of these errors.
The text was updated successfully, but these errors were encountered: