emicklei / htmlslog

Go slog.Handler that produces HTML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

html slog

package main

import (
	"fmt"
	"log/slog"

	"github.com/emicklei/htmlslog"
)

func main() {
	handler := htmlslog.New(os.Stdout, htmlslog.Options{Level: slog.LevelInfo, Title: "Test"})
	mylog := slog.New(handler)
	mylog.Info("Hello, world!")
	handler.Close()
}

See https://goplay.tools/snippet/TaQ0B5ecFBX

About

Go slog.Handler that produces HTML


Languages

Language:Go 93.0%Language:HTML 7.0%