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

feat: update to go 1.21.0, add log/slog support #72

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ttys3
Copy link
Collaborator

@ttys3 ttys3 commented Aug 10, 2023

go 1.21.0 stdlib slog provides structured logging, in which log records include a message, a severity level, and various other attributes expressed as key-value pairs.

see https://pkg.go.dev/log/slog

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Merging #72 (ea06f45) into master (d6826ff) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   98.79%   98.80%   +0.01%     
==========================================
  Files          12       14       +2     
  Lines         581      588       +7     
==========================================
+ Hits          574      581       +7     
  Misses          5        5              
  Partials        2        2              
Files Changed Coverage Δ
staticrules.go 100.00% <ø> (ø)
internal/checkers/filter.go 100.00% <100.00%> (ø)
internal/checkers/slog.go 100.00% <100.00%> (ø)
internal/checkers/zap.go 100.00% <100.00%> (ø)
loggercheck.go 94.35% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ttys3 ttys3 requested a review from timonwong August 10, 2023 10:08
@ttys3 ttys3 marked this pull request as draft August 10, 2023 12:45
@ttys3
Copy link
Collaborator Author

ttys3 commented Aug 10, 2023

Oops, I found things missing ...

it has something like Zap:

// Group returns an Attr for a Group Value.
// The first argument is the key; the remaining arguments
// are converted to Attrs as in [Logger.Log].
//
// Use Group to collect several key-value pairs under a single
// key on a log line, or as the result of LogValue
// in order to log a single value as multiple Attrs.
func Group(key string, args ...any) Attr {
	return Attr{key, GroupValue(argsToAttrSlice(args)...)}
}

@ttys3 ttys3 marked this pull request as ready for review August 10, 2023 13:01
@ttys3
Copy link
Collaborator Author

ttys3 commented Aug 10, 2023

OK. fixed

@timonwong timonwong enabled auto-merge (squash) August 25, 2023 13:55
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.18', '1.19']
go: ['1.21']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not the best time to drop support for golang<1.21 for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go 1.21 and 1.22 is the only supported Stable versions now. https://go.dev/dl/

is this OK now?

@@ -4,6 +4,8 @@ import (
"context"
"errors"
"fmt"
"log/slog"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a build constraint?

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

Successfully merging this pull request may close these issues.

None yet

2 participants