log

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 4 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// LevelAll enables all logs.
	LevelAll = iota
	// LevelDebug logs are usually disabled in production.
	LevelDebug
	// LevelInfo is the default logging priority.
	LevelInfo
	// LevelWarn .
	LevelWarn
	// LevelError .
	LevelError
	// LevelNone disables all logs.
	LevelNone
)

Variables

View Source
var (
	// TimeFormat is used to format time parameters.
	TimeFormat = "2006/01/02 15:04:05.000"

	// Output is used to receive log output.
	Output io.Writer = os.Stdout

	// DefaultLogger is the default logger and is used by arpc
	DefaultLogger Logger = &logger{level: LevelInfo}
)

Functions

func Debug

func Debug(format string, v ...interface{})

Debug uses DefaultLogger to log a message at LevelDebug.

func Error

func Error(format string, v ...interface{})

Error uses DefaultLogger to log a message at LevelError.

func Info

func Info(format string, v ...interface{})

Info uses DefaultLogger to log a message at LevelInfo.

func SetLevel

func SetLevel(lvl int)

SetLevel sets default logger's priority.

func SetLogger

func SetLogger(l Logger)

SetLogger sets default logger.

func Warn

func Warn(format string, v ...interface{})

Warn uses DefaultLogger to log a message at LevelWarn.

Types

type Logger

type Logger interface {
	SetLevel(lvl int)
	Debug(format string, v ...interface{})
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
}

Logger defines log interface

Jump to

Keyboard shortcuts

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