log

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLogFormatter         = logging.MustStringFormatter("%{color}%{time:2006-01-02 15:04} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}")
	LowVerboseLogFormatter      = logging.MustStringFormatter("%{time:2006-01-02 15:04} ▶ %{level:.4s} %{message}")
	VerboseLogFilePathFormatter = logging.MustStringFormatter("%{color}%{time:2006-01-02 15:04} %{longpkg} %{longfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{longfile} %{message}")
)

Define the standard formatter

View Source
var Now = time.Now

Now - time.Now

Functions

func GetLogger

func GetLogger() *logging.Logger

GetLogger - Returns logger

func Init

func Init(appName string)

Init - Initializes the logger

func NewLogBackend

func NewLogBackend(out io.Writer, prefix string, flag int, level logging.Level, format logging.Formatter)

NewLogBackend - Creates new backend logging, it's necessary to call Init, to start the logging created

Types

type RotateFile added in v1.5.1

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

RotateFile - Define a wrapper for log file

func NewRotateFile added in v1.5.1

func NewRotateFile(filename string, flag int, perm os.FileMode, autoRotate bool) (*RotateFile, error)

NewRotateFile - Return a new Logging file instance

func (*RotateFile) Rotate added in v1.5.1

func (r *RotateFile) Rotate() error

Rotate - Rotates the file

func (*RotateFile) Write added in v1.5.1

func (r *RotateFile) Write(p []byte) (n int, err error)

Write - Implements io.Writer

Jump to

Keyboard shortcuts

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