log

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 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 Errorf added in v1.0.16

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

func GetLogDirectory added in v1.0.4

func GetLogDirectory() string

func Logf added in v1.0.23

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

Logf logs to the local log.

func Printf

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

Printf logs to the local log and send the log through the channel.

func Request

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

func Response

func Response(tag string, response interface{}, returnCode int, returnStr string, 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 info level.

func (*Logger) Errorf added in v1.0.16

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

Errorf logs a formatted string at info level and sends the string to TelemetryBuffer.

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) Logf added in v1.0.23

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

Logf wraps logf.

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{}, returnCode int, returnStr string, err error)

Response logs a structured response.

func (*Logger) SetChannel added in v1.0.16

func (logger *Logger) SetChannel(reports chan interface{})

SetChannel sets the channel for error message reports.

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