logger

package
v0.0.0-...-0908b45 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 13 Imported by: 73

Documentation

Index

Constants

View Source
const (
	NONE    = 0
	STATUS  = 1
	FATAL   = 2
	ERROR   = 3
	WARNING = 4
	INFO    = 5
	DEBUG   = 6
	TRACE   = 7
)

Log levels

View Source
const (
	FILE = iota
	STDOUT
	SYSLOG
	GLOG
)

Log destinations

Variables

This section is empty.

Functions

func AdjustMaxLogfileSize

func AdjustMaxLogfileSize(size int, defaultSize int, path string) (int, error)

AdjustMaxLogfileSize insures that the max log file size, when the deafult value is chosen is less than 1% of the file system containing the log file

Types

type Error

type Error struct {
	Message string
}

Error is the error struct used by the logger code

func (*Error) Error

func (e *Error) Error() string

type Logger

type Logger struct {
	Tracing                  bool
	Logger                   *golog.Logger
	Level                    int
	MaxFileSize              int64
	MaxCompressedFilesNumber int
	CurrentFile              *os.File

	Stdout bool
	Syslog io.Writer
	// contains filtered or unexported fields
}

Logger information needed for a logger (or trace)

func (*Logger) Debug

func (log *Logger) Debug(format string, a ...interface{})

Debug log

func (*Logger) Dump

func (log *Logger) Dump(label string, a interface{})

Dump a struct to the logger

func (*Logger) Error

func (log *Logger) Error(format string, a ...interface{})

Error log

func (*Logger) Fatal

func (log *Logger) Fatal(format string, a ...interface{})

Fatal log

func (*Logger) Info

func (log *Logger) Info(format string, a ...interface{})

Info log

func (*Logger) Init

func (log *Logger) Init(parameters Parameters) error

Init Initialize Logger

func (*Logger) IsLogging

func (log *Logger) IsLogging(level int) bool

IsLogging checks if the logging level if higher or equal to the level parameter

func (*Logger) ParseDestinationsList

func (log *Logger) ParseDestinationsList(destinations string) ([]bool, bool)

ParseDestinationsList parses a list of destinations

func (*Logger) StackTrace

func (log *Logger) StackTrace()

StackTrace will log the current stack trace

func (*Logger) Status

func (log *Logger) Status(format string, a ...interface{})

Status log

func (*Logger) Stop

func (log *Logger) Stop()

Stop Logger

func (*Logger) Trace

func (log *Logger) Trace(format string, a ...interface{})

Trace log

func (*Logger) Warning

func (log *Logger) Warning(format string, a ...interface{})

Warning log

type Parameters

type Parameters struct {
	RootPath                 string
	FileName                 string
	MaxFileSize              int
	MaxCompressedFilesNumber int
	Destinations             string
	Prefix                   string
	Level                    string
	MaintenanceInterval      int16
}

Parameters parameters for logger setup

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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