Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
Example ¶
package main
import (
"log/slog"
"os"
sloglambda "github.com/maddiesch/slog-lambda"
)
func main() {
handler := sloglambda.NewHandler(os.Stdout, sloglambda.WithJSON(), sloglambda.WithoutTime())
logger := slog.New(handler)
slog.SetDefault(logger)
slog.Info("Hello, world!")
}
Output: {"level":"INFO","msg":"Hello, world!","record":{"functionName":"test-function","functionVersion":"$LATEST"},"type":"app.log"}
type Option ¶
type Option func(*Handler)
func WithSource ¶
func WithSource() Option
func WithoutTime ¶
func WithoutTime() Option
Click to show internal directories.
Click to hide internal directories.