https://github.com/op/redlog
Gloss styles for log πͺ΅ and slog π
https://github.com/op/redlog
catppuccin go logging pastel slog structured-logging
Last synced: about 1 year ago
JSON representation
Gloss styles for log πͺ΅ and slog π
- Host: GitHub
- URL: https://github.com/op/redlog
- Owner: op
- License: mit
- Created: 2024-05-10T20:44:03.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-11T21:47:50.000Z (about 2 years ago)
- Last Synced: 2025-04-11T03:08:08.739Z (about 1 year ago)
- Topics: catppuccin, go, logging, pastel, slog, structured-logging
- Language: Go
- Homepage:
- Size: 82 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Red Log
Gloss styles for [logs][log]. πͺ΅
It contains a set of styles that can be used with the [log] package. The
following themes are provided:
* [catppucchin](https://catppuccin.com) -- adaptive variants
[log]: /charmbracelet/log
## Gallery
*Catppuccin Latte*

*Catppuccin FrappΓ©*

*Catppuccin Macchiato*

*Catppuccin Mocha*

## Usage
Use `go get` to download the dependency.
```bash
go get github.com/op/redlog@latest
```
Then, `import` it in Go files:
```go
import (
"github.com/charmbracelet/log"
"github.com/op/redlog"
)
```
The Red Log package comes with a select few styles of the themes listed above.
These are ready to be used straight away.
```go
log.SetStyles(redlog.Catppuccin.Mocha)
slog.SetDefault(slog.New(log.Default()))
```
## Specific theme
If you want to limit the number of dependencies, or make some customisation of
the theme yourself, you can directly import and use the theme.
```go
import (
"github.com/charmbracelet/log"
"github.com/op/redlog/pkg/catppuccin"
)
```
Then initiate the theme the way that suits your needs.
```go
// use an adaptive theme that switches between light and dark depending on the
// terminal's color scheme
variant := catppuccin.Adaptive(catppuccin.Latte, catppuccin.Mocha)
log.SetStyles(catppuccin.Styles(variant))
```