log

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 10 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 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 ErrorWriter

func ErrorWriter() *io.PipeWriter

func FatalDF

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

func FatalF

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

func InfoDF

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

func InfoF

func InfoF(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 TraceDF

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

func TraceF

func TraceF(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 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 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