log

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package log 是 SDK 的 logger 接口定义与内置的 logger。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

Debug log.Debug

func Debugf

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

Debugf log.Debugf

func Disable added in v0.2.0

func Disable()

Disable 关闭内置 logger

func Error

func Error(v ...interface{})

Error log.Error

func Errorf

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

Errorf log.Errorf

func Info

func Info(v ...interface{})

Info log.Info

func Infof

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

Infof log.Infof

func ReplaceDefault added in v0.2.0

func ReplaceDefault(l Logger)

ReplaceDefault 替换默认 logger, 需要实现 Logger 接口

func SetLogLevel

func SetLogLevel(l Level)

SetLogLevel set log level defaults to LevelInfo

func Sync

func Sync()

Sync logger Sync calls to flush buffer

func Warn

func Warn(v ...interface{})

Warn log.Warn

func Warnf

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

Warnf log.Warnf

Types

type Level

type Level int
const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelNone
)

type Logger

type Logger interface {
	Debug(v ...interface{})
	Info(v ...interface{})
	Warn(v ...interface{})
	Error(v ...interface{})

	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
	// Sync logger Sync calls to flush buffer
	Sync() error
}

Logger 日志需要实现的接口定义

var DefaultLogger Logger = new(consoleLogger)

DefaultLogger 默认logger

Jump to

Keyboard shortcuts

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