Git Product home page Git Product logo

slog-formatter's Issues

[formatter_http] cannot use lo.MapToSlice(req.Header, ...)

It doesn't compile.

Environment

  • OS: macOS Ventura 13.3.1 (a)
  • Go: go1.20.4

How to reproduce

$ mkdir slog-demo
$ cd slog-demo
$ go mod init slog-demo

main.go

package main

import (
	"os"
	"time"

	slogfiber "github.com/samber/slog-fiber"
	slogformatter "github.com/samber/slog-formatter"
	"golang.org/x/exp/slog"
)

func main() {
	// Create a slog logger, which:
	//   - Logs to stdout.
	//   - RFC3339 with UTC time format.
	logger := slog.New(
		slogformatter.NewFormatterHandler(
			slogformatter.TimezoneConverter(time.UTC),
			slogformatter.TimeFormatter(time.RFC3339, nil),
		)(
			slog.NewTextHandler(os.Stdout, nil),
		),
	)
	slogfiber.New(logger)
}
$ go mod tidy
$ go build

Expected Result

build with no error

Actual Result

# github.com/samber/slog-formatter
../../../.gvm/pkgsets/go1.20.4/global/pkg/mod/github.com/samber/[email protected]/formatter_http.go:19:5: cannot use lo.MapToSlice(req.Header, func(key string, values []string) slog.Attr {…}) (value of type []slog.Attr) as []any value in argument to slog.Group
../../../.gvm/pkgsets/go1.20.4/global/pkg/mod/github.com/samber/[email protected]/formatter_http.go:39:6: cannot use lo.MapToSlice(req.URL.Query(), func(key string, values []string) slog.Attr {…}) (value of type []slog.Attr) as []any value in argument to slog.Group
../../../.gvm/pkgsets/go1.20.4/global/pkg/mod/github.com/samber/[email protected]/formatter_http.go:57:5: cannot use lo.MapToSlice(res.Header, func(key string, values []string) slog.Attr {…}) (value of type []slog.Attr) as []any value in argument to slog.Group

Is there a plan for slog-gorm?

HI @samber

Thanks for your awesome work for slog, is there a plan for slog-gorm? You know, gorm is an famouse ORM framework, it will be wonderful if there is a slog adapter for it.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.