irisslog

package module
v0.0.0-...-895848e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 4 Imported by: 0

README

irisslog

Alternative logging through slog. A clone of https://github.com/iris-contrib/middleware 's zap.

This middleware will log all http requests with slog.

Current support go 1.20. So slog is "golang.org/x/exp/slog"

Usage

Start using it

Download and install it:

go get github.com/fnsne/irisslog@master

Import it in your code:

import "github.com/fnsne/irisslog"

todos

  • irisslog.New()
  • example
  • skip logging
  • custom fields

Example

See the example.

todo: add the right example

Skip logging

When you want to skip logging for specific path, please use NewWithConfig

Custom Zap fields

Example for custom log request body, response request ID or log Open Telemetry TraceID.

Documentation

Overview

Package iriszap provides log handling using zap package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(ctx iris.Context) *slog.Logger

func New

func New(logger *slog.Logger) func(ctx iris.Context)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL