filename

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

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

Go to latest
Published: Jul 11, 2019 License: MIT Imports: 4 Imported by: 24

README

This package is extracted from onrik/logrus.

USAGE

package main

import (
	"github.com/sirupsen/logrus"
	"github.com/keepeye/logrus-filename"
)

func main() {
	filenameHook := filename.NewHook()
	filenameHook.Field = "line"
	logrus.AddHook(filenameHook)
	logrus.Info("aha")
}

output:

INFO[0000] aha                                       line="box-api-server/test.go:12"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	Field string
	Skip  int

	Formatter func(file, function string, line int) string
	// contains filtered or unexported fields
}

func NewHook

func NewHook(levels ...logrus.Level) *Hook

func (*Hook) Fire

func (hook *Hook) Fire(entry *logrus.Entry) error

func (*Hook) Levels

func (hook *Hook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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