19 lines
355 B
Go
19 lines
355 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", event.Level, event.Message)
|
|
return nil
|
|
}
|