Skip to content
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

Preliminary slog verification suite #2

Open
madkins23 opened this issue Jan 15, 2024 · 0 comments
Open

Preliminary slog verification suite #2

madkins23 opened this issue Jan 15, 2024 · 0 comments

Comments

@madkins23
Copy link

madkins23 commented Jan 15, 2024

You may remember me from such recent console-slog issues as:

The reason I was familiar with the slog "rules" is that I was working on a verification test suite for slog handlers. I just made it public and tagged it as an alpha pre-release.

It's a lot of (likely over-engineered) code. You may not want to touch it. No big deal, I completely understand. However, if you do I would be interested in any feedback you might have. I've turned on issues and discussions for the repository.

In the meantime, here are the current warnings for phsym/zeroslog:

Warnings for phsym/zeroslog:
  Required
     1 Empty (sub)group(s) logged
       TestGroupWithMultiSubEmpty
         {"level":"info","first":"one","group":{"second":2,"third":"3","subGroup":{}},"time":"2024-01-16T08:44:52-08:00","message":"This is a message"}
     2 Empty attribute(s) logged ("":null)
       TestAttributeWithEmpty
         {"level":"info","":null,"first":"one","pi":3.141592653589793,"time":"2024-01-16T08:44:52-08:00","message":"This is a message"}
       TestAttributesEmpty
         {"level":"info","first":"one","":null,"pi":3.141592653589793,"time":"2024-01-16T08:44:52-08:00","message":"This is a message"}
     1 Group with empty key does not inline subfields
       TestGroupInline
         {"level":"info","first":"one","":{"second":2,"third":"3","fourth":"forth"},"pi":3.141592653589793,"time":"2024-01-16T08:44:52-08:00","message":"This is a message"}
     1 Zero time is logged
       TestZeroTime: 0001-01-01T00:00:00Z
         {"level":"info","time":"0001-01-01T00:00:00Z","message":"This is a message"}
  Implied
     4 HandlerOptions.ReplaceAttr not available
       TestReplaceAttr: too many attributes: 6, alpha == beta, change still exists, remove still exists
       TestReplaceAttrBasic: too many attributes: 4, time field still exists, message field still exists, source == <nil>
       TestReplaceAttrFnLevelCase: level value not null
       TestReplaceAttrFnRemoveTime: time value not empty string
     1 Source data not logged when AddSource flag set
       TestKey: no 'source' key
         {"level":"info","caller":"/snap/go/10489/src/reflect/value.go:596","time":"2024-01-16T08:44:52-08:00","message":"This is a message"}
     6 Wrong message key (should be 'msg')
       TestCancelledContext: `message`
       TestCancelledContext: `message`
       TestKey: `message`
       TestKeys: `message`
       TestZeroPC: `message`
       TestZeroTime: `message`
  Suggested
     2 Duplicate field(s) found
       TestAttributeDuplicate: map[alpha:2 charlie:3]
       TestAttributeWithDuplicate: map[alpha:2 charlie:3]
    10 Log level in lowercase
       TestCancelledContext: 'info'
       TestCancelledContext: 'info'
       TestKey: 'info'
       TestKeyCase: 'debug'
       TestKeyCase: 'info'
       TestKeyCase: 'warn'
       TestKeyCase: 'error'
       TestKeys: 'info'
       TestZeroPC: 'info'
       TestZeroTime: 'info'
     1 slog.Duration() logs milliseconds instead of nanoseconds
       TestLogAttributes
     1 slog.Time() logs milliseconds instead of nanoseconds
       TestLogAttributes: 2024-01-16T08:44:52-08:00

Not all of the warnings are important. Specifics of various warnings documented here. I'm not suggesting that you fix anything in particular, I just figured you might be interested in what I've done. For that matter, in the fullness of time I might submit some pull requests for specific simple fixes.

BTW: I also referenced this project in my documentation. Let me know if that is bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant