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.