vlog

package
v0.0.0-...-ebd5e3c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Level = LevelEnum{
	INFO:  "info",
	DEBUG: "debug",
	OFF:   "off",
	TRACE: "trace",
	WARN:  "warn",
	ERROR: "error",
	FATAL: "fatal",
}

Functions

func Debug

func Debug(v interface{})

Debug debug prints debug level msg.

func Debugf

func Debugf(format string, v interface{})

Debugf prints debug level msg with format.

func Error

func Error(v interface{})

Error err prints err level msg.

func Errorf

func Errorf(format string, v interface{})

Errorf prints err level msg with format.

func Fatal

func Fatal(v interface{})

Fatal prints fatal level msg and exit process with code 1.

func Fatalf

func Fatalf(format string, v interface{})

Fatalf prints fatal level msg with format and exit process with code 1.

func Info

func Info(v interface{})

Info prints info level msg.

func Infof

func Infof(format string, v interface{})

Infof prints info level msg with format.

func SetLevel

func SetLevel(level LevelType)

SetLevel sets the logging level of all loggers. (global)

func SetOutput

func SetOutput(w io.Writer)

SetOutput sets the output destination for the standard logger. (global)

func SetSyncOutput

func SetSyncOutput(b bool)

SetSyncOutput synchronize output settings to the default log library

func Warn

func Warn(v interface{})

Warn prints warning level msg.

func Warnf

func Warnf(format string, v interface{})

Warnf prints warning level msg with format.

Types

type Color

type Color string
const (
	DEBUG_COLOR Color = "\033[0;36m"
	INFO_COLOR  Color = "\033[0;32m"
	WARN_COLOR  Color = "\033[0;33m"
	ERROR_COLOR Color = "\033[0;31m"
	TRACE_COLOR Color = "\033[0;34m"
	FATAL_COLOR Color = "\033[0;35m"
)

type LevelEnum

type LevelEnum struct {
	INFO  LevelType
	DEBUG LevelType
	OFF   LevelType
	TRACE LevelType
	WARN  LevelType
	ERROR LevelType
	FATAL LevelType
}

type LevelType

type LevelType string

type Logger

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

Logger represents a simple logger with level. The underlying logger is the standard Go logging "log".

func Default

func Default() *Logger

Default create default logger

func New

func New(out io.Writer) *Logger

New creates a logger.

func NewFlag

func NewFlag(out io.Writer, flag int) *Logger

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

Debug debug prints debug level msg.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf prints debug level msg with format.

func (*Logger) Error

func (l *Logger) Error(v ...interface{})

Error err prints err level msg.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

Errorf prints err level msg with format.

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

Fatal prints fatal level msg and exit process with code 1.

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf prints fatal level msg with format and exit process with code 1.

func (*Logger) Info

func (l *Logger) Info(v ...interface{})

Info prints info level msg.

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

Infof prints info level msg with format.

func (*Logger) IsDebugEnabled

func (l *Logger) IsDebugEnabled() bool

IsDebugEnabled determines whether the debug level is enabled.

func (*Logger) IsTraceEnabled

func (l *Logger) IsTraceEnabled() bool

IsTraceEnabled determines whether the trace level is enabled.

func (*Logger) IsWarnEnabled

func (l *Logger) IsWarnEnabled() bool

IsWarnEnabled determines whether the debug level is enabled.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level LevelType)

SetLevel sets the logging level of a logger.

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

SetOutput sets the output destination for the standard logger.

func (*Logger) Trace

func (l *Logger) Trace(v ...interface{})

Trace prints trace level msg.

func (*Logger) Tracef

func (l *Logger) Tracef(format string, v ...interface{})

Tracef prints trace level msg with format.

func (*Logger) Warn

func (l *Logger) Warn(v ...interface{})

Warn prints warning level msg.

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

Warnf prints warning level msg with format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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