xlog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: BSD-3-Clause Imports: 6 Imported by: 48

Documentation

Index

Constants

View Source
const (
	// D_LOG_FLAGS is the default log flags.
	D_LOG_FLAGS int = log.LstdFlags | log.Lmicroseconds | log.Lshortfile
)

Variables

View Source
var LevelNames = [...]string{
	DEBUG:   "DEBUG",
	INFO:    "INFO",
	WARNING: "WARNING",
	ERROR:   "ERROR",
	FATAL:   "FATAL",
	PANIC:   "PANIC",
}

LevelNames represents the string name of all levels.

Functions

This section is empty.

Types

type Log

type Log struct {
	*log.Logger
	// contains filtered or unexported fields
}

Log struct.

func GetLog

func GetLog() *Log

GetLog returns Log.

func NewLog

func NewLog(w io.Writer, prefix string, flag int) *Log

NewLog creates the new log.

func NewStdLog

func NewStdLog(opts ...Option) *Log

NewStdLog creates a new std log.

func NewSysLog

func NewSysLog(opts ...Option) *Log

NewSysLog creates a new sys log.

func NewXLog

func NewXLog(w io.Writer, opts ...Option) *Log

NewXLog creates a new xlog.

func (*Log) Close

func (t *Log) Close()

Close used to close the log.

func (*Log) Debug

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

Debug used to log debug msg.

func (*Log) Error

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

Error used to log error msg.

func (*Log) Fatal

func (t *Log) Fatal(format string, v ...interface{})

Fatal used to log faltal msg.

func (*Log) Info

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

Info used to log info msg.

func (*Log) Panic

func (t *Log) Panic(format string, v ...interface{})

Panic used to log panic msg.

func (*Log) SetLevel

func (t *Log) SetLevel(level string)

SetLevel used to set the log level.

func (*Log) Warning

func (t *Log) Warning(format string, v ...interface{})

Warning used to log warning msg.

type LogLevel

type LogLevel int

LogLevel used for log level.

const (
	// DEBUG enum.
	DEBUG LogLevel = 1 << iota
	// INFO enum.
	INFO
	// WARNING enum.
	WARNING
	// ERROR enum.
	ERROR
	// FATAL enum.
	FATAL
	// PANIC enum.
	PANIC
)

type Option

type Option func(*Options)

Option func.

func Level

func Level(v LogLevel) Option

Level used to set the log level.

func Name

func Name(v string) Option

Name used to set the name.

type Options

type Options struct {
	Name  string
	Level LogLevel
}

Options used for the options of the xlog.

Jump to

Keyboard shortcuts

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