log

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 29

Documentation

Index

Constants

View Source
const (
	StandardTimestampFormat = "2006-01-02T15:04:05.000"
	DefaultTimestampFormat  = "20060102-150405.00"
)

Variables

View Source
var (
	Config = &Configuration{
		DisableTimestamp: false,
		TimestampFormat:  DefaultTimestampFormat,
		LoggingFormat:    FormatPretty,
		LogLevel:         LevelInfo,
		LogHook:          "stdout",
		AppName:          "",
		PapertrailHost:   "",
		PapertrailPort:   0,
		PapertrailTag:    "",
	}
)
View Source
var Levels = map[string]Level{
	"error": LevelError,
	"warn":  LevelWarn,
	"info":  LevelInfo,
	"debug": LevelDebug,
	"trace": LevelTrace,
}

Functions

func DebugDF

func DebugDF(depth int, format string, argv ...interface{})

func DebugF

func DebugF(format string, argv ...interface{})

func DebugRDF added in v0.1.0

func DebugRDF(r *http.Request, depth int, format string, argv ...interface{})

func DebugRF added in v0.1.0

func DebugRF(r *http.Request, format string, argv ...interface{})

func DebugWriter

func DebugWriter() *io.PipeWriter

func Error

func Error(err error)

func ErrorDF

func ErrorDF(depth int, format string, argv ...interface{})

func ErrorF

func ErrorF(format string, argv ...interface{})

func ErrorR added in v0.1.0

func ErrorR(r *http.Request, err error)

func ErrorRDF added in v0.1.0

func ErrorRDF(r *http.Request, depth int, format string, argv ...interface{})

func ErrorRF added in v0.1.0

func ErrorRF(r *http.Request, format string, argv ...interface{})

func ErrorWriter

func ErrorWriter() *io.PipeWriter

func FatalDF

func FatalDF(depth int, format string, argv ...interface{})

func FatalF

func FatalF(format string, argv ...interface{})

func FatalRDF added in v0.1.0

func FatalRDF(r *http.Request, depth int, format string, argv ...interface{})

func FatalRF added in v0.1.0

func FatalRF(r *http.Request, format string, argv ...interface{})

func InfoDF

func InfoDF(depth int, format string, argv ...interface{})

func InfoF

func InfoF(format string, argv ...interface{})

func InfoRDF added in v0.1.0

func InfoRDF(r *http.Request, depth int, format string, argv ...interface{})

func InfoRF added in v0.1.0

func InfoRF(r *http.Request, format string, argv ...interface{})

func InfoWriter

func InfoWriter() *io.PipeWriter

func Logger

func Logger() *log.Logger

func Logrus

func Logrus() *logrus.Logger

func NewPapertrailHook

func NewPapertrailHook(appName, host string, port int) (*papertrail.Hook, error)

func PanicDF

func PanicDF(depth int, format string, argv ...interface{})

func PanicF

func PanicF(format string, argv ...interface{})

func PanicRDF added in v0.1.0

func PanicRDF(r *http.Request, depth int, format string, argv ...interface{})

func PanicRF added in v0.1.0

func PanicRF(r *http.Request, format string, argv ...interface{})

func PrefixedLogger added in v0.2.0

func PrefixedLogger(prefix string) (logging *log.Logger)

func TraceDF

func TraceDF(depth int, format string, argv ...interface{})

func TraceF

func TraceF(format string, argv ...interface{})

func TraceRDF added in v0.1.0

func TraceRDF(r *http.Request, depth int, format string, argv ...interface{})

func TraceRF added in v0.1.0

func TraceRF(r *http.Request, format string, argv ...interface{})

func TraceWriter

func TraceWriter() *io.PipeWriter

func WarnDF

func WarnDF(depth int, format string, argv ...interface{})

func WarnF

func WarnF(format string, argv ...interface{})

func WarnRDF added in v0.1.0

func WarnRDF(r *http.Request, depth int, format string, argv ...interface{})

func WarnRF added in v0.1.0

func WarnRF(r *http.Request, format string, argv ...interface{})

func WarnWriter

func WarnWriter() *io.PipeWriter

Types

type Configuration

type Configuration struct {
	DisableTimestamp bool
	TimestampFormat  string
	LoggingFormat    Format
	LogLevel         Level
	LogHook          string
	AppName          string
	PapertrailHost   string
	PapertrailPort   int
	PapertrailTag    string
}

func (Configuration) Apply

func (c Configuration) Apply()

type Format

type Format int
const (
	FormatPretty Format = iota
	FormatJson
	FormatText
)

type Level

type Level int
const (
	LevelError Level = iota
	LevelWarn
	LevelInfo
	LevelDebug
	LevelTrace
)

type LogfLogger added in v0.2.0

type LogfLogger Level

func NewLogf added in v0.2.0

func NewLogf(level Level) LogfLogger

func (LogfLogger) Logf added in v0.2.0

func (l LogfLogger) Logf(format string, argv ...interface{})

type SyslogHook

type SyslogHook struct {
	Writer        *syslog.Writer
	SyslogNetwork string
	SyslogRaddr   string
}

func NewSyslogLocalHook

func NewSyslogLocalHook(priority syslog.Priority, tag string) (*SyslogHook, error)

func NewSyslogNetworkHook

func NewSyslogNetworkHook(network, raddr string, priority syslog.Priority, tag string) (*SyslogHook, error)

func (*SyslogHook) Fire

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

func (*SyslogHook) Levels

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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