log

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelAlert = iota
	LevelError
	LevelWarning
	LevelInfo
	LevelDebug
)

Log level

View Source
const (
	TargetStderr = iota
	TargetSyslog
	TargetLogfile
	TargetStdout
	TargetStdOutAndLogFile
)

Log target

View Source
const (
	// LogPath is the path where log files are stored.
	LogPath = "/var/log/"
)

Variables

This section is empty.

Functions

func Close

func Close()

func Debugf

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

func GetLogDirectory added in v1.0.4

func GetLogDirectory() string

func Printf

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

func Request

func Request(tag string, request interface{}, err error)

func Response

func Response(tag string, response interface{}, err error)

func SetLevel

func SetLevel(level int)

func SetLogDirectory added in v1.0.4

func SetLogDirectory(logDirectory string)

func SetLogFileLimits

func SetLogFileLimits(maxFileSize int, maxFileCount int)

func SetName

func SetName(name string)

func SetTarget

func SetTarget(target int) error

Types

type Logger

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

Logger object

func GetStd

func GetStd() *Logger

GetStd - Helper functions for the standard logger.

func NewLogger

func NewLogger(name string, level int, target int) *Logger

NewLogger creates a new Logger.

func (*Logger) Close

func (logger *Logger) Close()

Close closes the log stream.

func (*Logger) Debugf

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

Debugf logs a formatted string at debug level.

func (*Logger) GetLogDirectory added in v1.0.4

func (logger *Logger) GetLogDirectory() string

GetLogDirectory gets the directory location where logs should be stored.

func (*Logger) Printf

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

Printf logs a formatted string at info level.

func (*Logger) Request

func (logger *Logger) Request(tag string, request interface{}, err error)

Request logs a structured request.

func (*Logger) Response

func (logger *Logger) Response(tag string, response interface{}, err error)

Response logs a structured response.

func (*Logger) SetLevel

func (logger *Logger) SetLevel(level int)

SetLevel sets the log chattiness.

func (*Logger) SetLogDirectory added in v1.0.4

func (logger *Logger) SetLogDirectory(logDirectory string)

SetLogDirectory sets the directory location where logs should be stored.

func (*Logger) SetLogFileLimits

func (logger *Logger) SetLogFileLimits(maxFileSize int, maxFileCount int)

SetLogFileLimits sets the log file limits.

func (*Logger) SetName

func (logger *Logger) SetName(name string)

SetName sets the log name.

func (*Logger) SetTarget

func (logger *Logger) SetTarget(target int) error

SetTarget sets the log target.

Jump to

Keyboard shortcuts

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