apachelog

package module
v0.0.0-...-b427549 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2015 License: MIT Imports: 4 Imported by: 0

README

go-echo-apachelog

Apache-style logger for echo

Usage

If you just want to see the access log in STDERR:

  e.Use(apachelog.Logger(os.Stderr))

If you want to rotate logs and such, you will need to replace the destination, so you should keep the ApacheLog struct:

  l := &ApacheLog{}
  l.LogFormat = logformat.CombinedLog.Clone()
  l.LogFormat.SetOutput(dst)

  e.Use(l.Wrap)

  // elsewhere in your code...
  l.LogFormat.SetOutput(newLogDestination)

Or you can use go-file-rotatelogs

  rl := rotatelogs.NewRotateLogs( ... )
  e.Use(apachelog.Logger(rl))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(dst io.Writer) echo.MiddlewareFunc

Types

type ApacheLog

type ApacheLog struct {
	LogFormat *logformat.ApacheLog
}

ApacheLog contains the basic information we need to log the access

func (*ApacheLog) Wrap

Jump to

Keyboard shortcuts

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