Releases: charmbracelet/log
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.
v0.2.0
BREAKING CHANGE
- Drop functional options.
- Introduce
log.NewWithOptions(io.Writer, log.Options)
andlog.Options{}
to create a new logger with custom options. - Add format methods to format the log message just like
fmt.Printf()
. - Add
log.WithPrefix(string)
that returns a new sub-logger with prefix. - Parse level from string
log.ParseLevel(string)
- Custom key/value styles.
- Caller source formatter.
- And a bunch of bug fixes.
Changelog
New Features
- ecd1551: feat(caller): add caller formatter (@aymanbagabas)
- 5315620: feat(examples): put examples in a separate module (@aymanbagabas)
- 2285bce: feat(log): add format methods (@aymanbagabas)
- 40c0aef: feat(log): set custom format keys (@aymanbagabas)
- 99fa380: feat(log): sub-logger with prefix (@aymanbagabas)
- 169c012: feat(styles): style certain keys (@aymanbagabas)
- 391e751: feat(text): style certain values (@aymanbagabas)
- a2100d4: feat(text): use lipgloss renderer (@aymanbagabas)
- baccac6: feat: parse level from string (#11) (@gozeloglu)
Bug fixes
- 632a426: fix(go): make log compliant with go1.15 (@aymanbagabas)
- cc3834d: fix(text): style multiline value before rendering (@aymanbagabas)
Dependency updates
- e6729aa: feat(deps): bump github.com/charmbracelet/lipgloss from 0.7.0 to 0.7.1 (@dependabot[bot])
- 6630e96: feat(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (@dependabot[bot])
Documentation updates
- 26aaaae: docs: add codecov & go report badges (@aymanbagabas)
- 5da9367: docs: add format methods (@aymanbagabas)
- 6b05768: docs: add light background gifs (@aymanbagabas)
- 65ede51: docs: add missing info level info to README (@meowgorithm)
- a9f75d2: docs: add styles section and examples (@aymanbagabas)
- 07a423f: docs: update gifys (@aymanbagabas)
- 9519a70: docs: update readme examples (@aymanbagabas)
- b6dcc9b: docs: update styles example (@aymanbagabas)
- 462efd0: docs: update sublogger gify (@aymanbagabas)
- 17a651c: docs: use picture tags (@aymanbagabas)
Other work
- 39de9ca: add batch and chocolate chips NV pairs (@tomdotorg)
- 761ad44: fix(text) escape value before rendering styles (#20) (@tombell)
- 395e398: ref(log): reduce struct props (@aymanbagabas)
- 010ab90: ref(log): use log options to initialize new loggers (@aymanbagabas)
- 685b3e2: revert: dark mode gifs (@maaslalani)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.
v0.1.2
Changelog
New Features
- 169c012: feat(styles): style certain keys (@aymanbagabas)
- baccac6: feat: parse level from string (#11) (@gozeloglu)
Bug fixes
- 44db2e7: fix(go): make log compliant with go1.15 (@aymanbagabas)
- cc3834d: fix(text): style multiline value before rendering (@aymanbagabas)
Dependency updates
- 6630e96: feat(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (@dependabot[bot])
Documentation updates
- 6b05768: docs: add light background gifs (@aymanbagabas)
- a9f75d2: docs: add styles section and examples (@aymanbagabas)
- 462efd0: docs: update sublogger gify (@aymanbagabas)
- 17a651c: docs: use picture tags (@aymanbagabas)
Other work
- 39de9ca: add batch and chocolate chips NV pairs (@tomdotorg)
- 761ad44: fix(text) escape value before rendering styles (#20) (@tombell)
- c158121: ref(log): reduce struct props (@aymanbagabas)
- 685b3e2: revert: dark mode gifs (@maaslalani)
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or on Discord.