Releases: charmbracelet/log
v0.4.2
This release fixes an issue when using the JSON logger as a slog handler logging error type messages. It ensures we extract the error from the message when the error does not implement json.Marshaler
.
Changelog
Bug fixes
- 71b7e86: fix: ensure we recognize errors as slog.AnyValue (#171) (@aymanbagabas)
Other work
- 0e0124d: ci: sync dependabot config (#169) (@charmcli)
- cf6e867: ci: sync golangci-lint config (#165) (@github-actions[bot])
- 0ca0612: ci: sync golangci-lint config (#168) (@github-actions[bot])
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.4.1
This release includes bug fixes for custom slog levels, data race with the default logger and deep copying fields, JSON handling improvements, and supporting slog attributes.
Changelog
New Features
- d3e462e: feat(ci): update linter config and add sync job (@aymanbagabas)
- dd7bc94: feat: preserve order when writing json (@op)
- fb820d2: feat: support slog attributes (#127) (@op)
Bug fixes
- 81cf0ff: fix: deep copy the fields to avoid data race (#128) (@yuguorui)
- deae1b0: fix: fix data race in Default and SetDefault (@op)
- 62ddc70: fix: lint issues (@aymanbagabas)
- 2b8ec72: fix: support custom slog levels (#117) (@lvlcn-t)
Dependency updates
- 82b5630: feat(deps): bump github.com/charmbracelet/lipgloss from 0.10.0 to 0.11.0 (#129) (@dependabot[bot])
- d1e7d89: feat(deps): bump github.com/charmbracelet/lipgloss from 0.11.0 to 0.12.1 (#136) (@dependabot[bot])
- 624268e: feat(deps): bump github.com/charmbracelet/lipgloss from 0.12.1 to 0.13.0 (#140) (@dependabot[bot])
- dc6766f: feat(deps): bump github.com/charmbracelet/lipgloss from 0.13.0 to 0.13.1 (#146) (@dependabot[bot])
- cca527f: feat(deps): bump github.com/charmbracelet/lipgloss from 0.13.1 to 1.0.0 (#148) (@dependabot[bot])
- 1e6353e: feat(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#153) (@dependabot[bot])
Documentation updates
Other work
- f954dc8: change type of Level to int (#141) (@imjasonh)
- fb71c7e: ci: sync dependabot config (#158) (@charmcli)
- c3793d7: ci: sync dependabot config (@charmcli)
- cb97f10: ci: sync golangci-lint config (#161) (@github-actions[bot])
- 2660c82: ci: sync golangci-lint config (#162) (@github-actions[bot])
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.4.0
Custom Levels
With this release of Log, you can now style your custom level to your liking!
// Define a new level
const SuccessLevel = log.InfoLevel + 1
// Create a style
styles := log.DefaultStyles()
styles.Levels[SuccessLevel] = lipgloss.NewStyle().
SetString("SUCCESS").
Bold(true).
Foreground(lipgloss.Color("42"))
// Set the styles on the default logger
log.SetStyles(styles)
// Define your custom func
func Success(msg string, args ...any) {
log.Default().Log(SuccessLevel, msg, args...)
}
Along with that, this release includes some important bug fixes detailed below.
Changelog
New Features
- 2338a13: feat: expose log function (#95) (@aymanbagabas)
Bug fixes
Dependency updates
- bcd4738: feat(deps): bump github.com/charmbracelet/lipgloss from 0.9.1 to 0.10.0 (#112) (@dependabot[bot])
- 976db2b: feat(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#108) (@dependabot[bot])
Documentation updates
- 87252e4: docs: Replace function with func in README sample code (@szktkfm)
- ac0e6b1: docs: direct users to library API (#73) (@bashbunni)
- 9d04d2b: docs: style customization updated (#106) (@ssantoshp)
Other work
- a424643: Create CODEOWNERS (@maaslalani)
- fd1729a: Options.CallerFormatter documentation issue (#100) (@pythonian23)
- f2cb6b6: ci: test on go define in go.mod (#102) (@caarlos0)
- d23bea6: fix!: respect time function (#115) (@aymanbagabas)
- 7a3834f: slog: Don't log if not enabled at level (#103) (@imjasonh)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.3.1
Changelog
New Features
- de79c17: feat(logger): implement slog.Handler (#13) (@aymanbagabas)
- bd09619: feat: set custom styles (#84) (@aymanbagabas)
Bug fixes
- 7472e59: fix: dry writeSpace (@aymanbagabas)
- b7f36a8: fix: use const colors to skip reading querying for the terminal bg color (#93) (@aymanbagabas)
Dependency updates
- e5a733b: feat(deps): bump github.com/charmbracelet/lipgloss from 0.8.0 to 0.9.1 (#76) (@dependabot[bot])
Documentation updates
Other work
- 5e84160: Handle Empty Messages (#82) (@dezren39)
- f36448c: doc: add gum to readme (@aymanbagabas)
- d96bea2: refactor!: return Error from ParseLevel (#83) (@dezren39)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.3.0
This new release of Log adds support for log/slog
, and per-instance styles, and includes bug fixes. You can now use Log as a log/slog
handler in your applications. Log comes with its own JSON and Logfmt formatters, on the other hand, Slog uses different handlers for these formats.
Breaking Changes!
- Bump the minimum GoLang version to 1.19
- Change the default timestamp key from
ts
totime
to matchlog/slog
- Change the default level key from
lvl
tolevel
to matchlog/slog
ParseLevel()
now returns an error if parse failed to find a level in string- Default levels values changed to be increments of 4 i.e.
DebugLevel = -4, InfoLevel = 0, WarnLevel = 4, ...
- Global styles are replaced with
DefaultStyles()
andSetStyles()
Changelog
New Features
- 5155c4f: feat(logger): implement slog.Handler (@aymanbagabas)
- 588043a: feat: add slog tests (@aymanbagabas)
- 7e55b91: feat: compile for go1.20 and go1.21 (@aymanbagabas)
- bd09619: feat: set custom styles (#84) (@aymanbagabas)
Bug fixes
- 707eb77: fix: add emoji test (@aymanbagabas)
- 7472e59: fix: dry writeSpace (@aymanbagabas)
- 1231b7b: fix: lint (@aymanbagabas)
Dependency updates
- e5a733b: feat(deps): bump github.com/charmbracelet/lipgloss from 0.8.0 to 0.9.1 (#76) (@dependabot[bot])
Other work
- 5e84160: Handle Empty Messages (#82) (@dezren39)
- 85d52ab: doc: add slog support (@aymanbagabas)
- d96bea2: refactor!: return Error from ParseLevel (#83) (@dezren39)
- 283fdeb: refactor: match log/slog level values (@aymanbagabas)
- 9c25f94: refactor: rename files (@aymanbagabas)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.2.5
Changelog
New Features
- 851c1b0: feat: set lipgloss renderer color profile (#69) (@aymanbagabas)
Bug fixes
- 6c11a72: fix(ci): fail ci on lint issues; enable nolintlint (#70) (@alexandear)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.2.4
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
Full Changelog: v0.2.3...v0.2.4
v0.2.3
Changelog
New Features
- 280c4e3: feat: export context key (#65) (@aymanbagabas)
Bug fixes
- e0ec0b1: fix: log.With() race condition (#64) (@alexvelea)
- 97dd8c9: fix: race condition when creating standard logger (#68) (@aymanbagabas)
- fb99176: fix: remove extraneous colon from prefix key (@aymanbagabas)
Dependency updates
- 31d2a53: feat(deps): bump github.com/muesli/termenv from 0.15.1 to 0.15.2 (@dependabot[bot])
- c39b96e: feat(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 (@dependabot[bot])
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.2.2
Changelog
New Features
- 96a7043: feat(calleroffset): added option to config custom caller offset (@waffle69691337)
Bug fixes
- dc01e9b: fix(ci): remove soft-serve workflow (@aymanbagabas)
Dependency updates
- 347b8ef: feat(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3 (@dependabot[bot])
Documentation updates
- afe34d9: docs: license (@caarlos0)
- ffabf4a: docs: update README.md (@aymanbagabas)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.2.1
Changelog
Bug fixes
- 89a61d4: fix(ci): setup go before lint (@aymanbagabas)
- 6e534d0: fix(output): cache lipgloss renderers (#52) (@aymanbagabas)
Dependency updates
- 8ca9b06: feat(deps): bump github.com/mattn/go-isatty from 0.0.17 to 0.0.18 (@dependabot[bot])
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.