19 lines
343 B
Go
19 lines
343 B
Go
package simplelog
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/fatih/color"
|
|
)
|
|
|
|
type ConsoleHandler struct{}
|
|
|
|
func NewConsoleHandler() *ConsoleHandler {
|
|
return &ConsoleHandler{}
|
|
}
|
|
|
|
func (c *ConsoleHandler) Log(level slog.Level, message string, data ...slog.Field) error {
|
|
color.New(color.FgBlue).PrintfFunc()("%s: %s\n", level, message)
|
|
return nil
|
|
}
|