zeroecho

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 8 Imported by: 0

README

zeroecho

zeroecho is a zerolog wrapper for Echo.

Installation

go get github.com/johnmanjiro13/zeroecho

Usage

package main

import (
    "net/http"
    "os"

    "github.com/johnmanjiro13/zeroecho"
    "github.com/labstack/echo"
)

func main() {
    e := echo.New()

    // Setup logger
    logger := zeroecho.New(os.Stdout, "")
    e.Logger = logger

    // Use logging middleware
    e.Use(zeroecho.RequestLogger(zeroecho.Config{
        Logger:  logger,
    }))

    e.GET("/", func(c echo.Context) error {
        return c.String(http.StatusOK, "Hello, world!")
    })
    e.Logger.Fatal(e.Start(":1323"))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestLogger

func RequestLogger(config Config) echo.MiddlewareFunc

Types

type Config

type Config struct {
	Skipper middleware.Skipper
	Logger  *Logger
}

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func New

func New(out io.Writer, prefix string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(i ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Debugj

func (l *Logger) Debugj(j log.JSON)

func (*Logger) Error

func (l *Logger) Error(i ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

func (*Logger) Errorj

func (l *Logger) Errorj(j log.JSON)

func (*Logger) Fatal

func (l *Logger) Fatal(i ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

func (*Logger) Fatalj

func (l *Logger) Fatalj(j log.JSON)

func (*Logger) Info

func (l *Logger) Info(i ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

func (*Logger) Infoj

func (l *Logger) Infoj(j log.JSON)

func (*Logger) Level

func (l *Logger) Level() log.Lvl

func (*Logger) Output

func (l *Logger) Output() io.Writer

func (*Logger) Panic

func (l *Logger) Panic(i ...interface{})

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...interface{})

func (*Logger) Panicj

func (l *Logger) Panicj(j log.JSON)

func (*Logger) Prefix

func (l *Logger) Prefix() string

func (*Logger) Print

func (l *Logger) Print(i ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...interface{})

func (*Logger) Printj

func (l *Logger) Printj(j log.JSON)

func (*Logger) SetHeader

func (l *Logger) SetHeader(h string)

func (*Logger) SetLevel

func (l *Logger) SetLevel(lvl log.Lvl)

func (*Logger) SetOutput

func (l *Logger) SetOutput(newOut io.Writer)

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(p string)

func (*Logger) Warn

func (l *Logger) Warn(i ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

func (*Logger) Warnj

func (l *Logger) Warnj(j log.JSON)

Jump to

Keyboard shortcuts

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