Releases: charmbracelet/log
v2.0.0
What's New in Log v2
We're excited to announce the second major release of Log!
Note
If you're looking for technical details on migrating from v1, check out the Upgrade Guide.
❤️ Charm Land Import Path
We've updated our import paths to use vanity domains and our own domain to import Go packages.
// Before
import "github.com/charmbracelet/log"
// After
import "charm.land/log/v2"🎨 Lip Gloss v2
Log v2 now uses Lip Gloss v2, which brings a pure, streamlined styling experience. No more fighting over i/o! Lip Gloss is now pure, which means Log manages i/o and styling flows smoothly without conflicts.
What does this mean for you? Built-in color downsampling. Your logs will look great in any terminal, automatically downsampling colors to match the terminal's capabilities. No more broken colors in limited color environments.
🌈 Modern Color Profile Support
Log v2 uses the colorprofile library to automatically detect and adapt to your terminal's color capabilities. Your logs will "just work" across all terminals, from basic 16-color setups to true color displays.
Colors are automatically downsampled to the best available profile, so your styled logs never misbehave—whether you're in a fancy modern terminal or a basic SSH session.
🔧 Simpler API
We've cleaned up the API to make working with color profiles more intuitive:
// Set a color profile manually
logger.SetColorProfile(colorprofile.TrueColor)
// The logger automatically handles downsamplingThe SetColorProfile method now uses colorprofile.Profile instead of termenv.Profile, giving you direct control over color handling with a modern, well-supported library.
✨ Updated Styles with Lip Gloss v2
All style fields in the Styles struct now use Lip Gloss v2. The styling API remains familiar, but benefits from improved performance and the new pure architecture:
styles := log.DefaultStyles()
styles.Levels[log.ErrorLevel] = lipgloss.NewStyle().
SetString("ERROR!!").
Padding(0, 1, 0, 1).
Background(lipgloss.Color("204")).
Foreground(lipgloss.Color("0"))Lip Gloss v2 brings better rendering, improved performance, and a cleaner separation of concerns between styling and i/o.
🚀 Better Performance
With the move to Lip Gloss v2 and colorprofile, Log v2 delivers:
- Faster rendering — Pure Lip Gloss means less overhead
- Smarter color handling — Automatic downsampling reduces unnecessary processing
- Cleaner output — Colors that work correctly in every environment
📦 Smaller Dependency Tree
Log v2 has a streamlined set of dependencies:
- charm.land/lipgloss/v2 — Pure styling, no i/o conflicts
- github.com/charmbracelet/colorprofile — Smart color detection and downsampling
- Removed termenv dependency — Everything handled through modern libraries
🔮 Ready for the Future
The v2 architecture sets Log up for future enhancements. The pure Lip Gloss foundation and modern color handling mean we can add new features without architectural constraints.
🌍 What Stays the Same
All the features you love about Log are still here:
- ✅ Leveled logging (Debug, Info, Warn, Error, Fatal)
- ✅ Structured key-value pairs
- ✅ Customizable styles and colors
- ✅ Multiple formatters (Text, JSON, Logfmt)
- ✅ Sub-loggers with context
- ✅ Slog handler support
- ✅ Standard log adapter
- ✅ Helper functions
- ✅ Timestamp and caller reporting
The core API remains familiar—you're just getting better performance and color handling under the hood.
🌈 More on Log v2
Ready to upgrade? Head over to the Upgrade Guide for the complete migration checklist.
Changelog
New!
- 32debe4: feat(ci): use goreleaser for releases (@aymanbagabas)
- fa91da8: feat: use lipgloss/v2 (#149) (@caarlos0)
Fixed
- e49b919: fix(ci): replace revive lint ignore with golangci-lint text rule (@aymanbagabas)
- 838c7fd: fix(ci): simplify build workflow (@aymanbagabas)
- 575a064: fix(ci): update go versions in build matrix (@aymanbagabas)
- ec72699: fix(ci): use local golangci config (@aymanbagabas)
- 95e061c: fix(test): pass all tests using shampoo.Writer (@bashbunni)
- 7671c0f: fix(test): use shampoo in stdlog_test (@bashbunni)
- e17476b: fix: buffer writes n stuff (@bashbunni)
- c379e29: fix: properly handle downsampling colors (@aymanbagabas)
- 978e922: fix: rename mod to /v2, update lipgloss (@caarlos0)
Docs
- c538e69: docs: add upgrade guide for Log v2 (#195) (@aymanbagabas)
Other stuff
- 358b526: ci: update go (@caarlos0)
- 8ee8d2a: refactor: first commit where the program runs... failing tests (@bashbunni)
- 529bb77: refactor: migrate to charm.land domain (#190) (@aymanbagabas)
Feedback
Have thoughts on Log v2? We'd love to hear about it. Let us know on…
Part of Charm.
Charm热爱开源 • Charm loves open source • نحنُ نحب المصادر المفتوحة
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
tstotimeto matchlog/slog - Change the default level key from
lvltolevelto 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.
