Skip to content
/ redlog Public

Gloss styles for log 🪵 and slog 💄

License

Notifications You must be signed in to change notification settings

op/redlog

Repository files navigation

Red Log

Latest Release Go Docs Build Status Go Report Card

Gloss styles for logs. 🪵

It contains a set of styles that can be used with the log package. The following themes are provided:

Gallery

Catppuccin Latte

catppuccin latte

Catppuccin Frappé

catppuccin frappe

Catppuccin Macchiato

catppuccin macchiato

Catppuccin Mocha

catppuccin mocha

Usage

Use go get to download the dependency.

go get github.com/op/redlog@latest

Then, import it in Go files:

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.

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.

import (
  "github.com/charmbracelet/log"
  "github.com/op/redlog/pkg/catppuccin"
)

Then initiate the theme the way that suits your needs.

// 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))

About

Gloss styles for log 🪵 and slog 💄

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors