log

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 2

README

log

go get  github.com/5xxxx/log

Init

    log.Init()
    log.Info("test info")
	log.Debug("test debug")
	log.Warn("test warn")
	log.Error("test error")
	log.Panic("test panic")

file

    log.Init(options.LogType(options.File),
		options.Path("./logs"),
		options.MaxAges(10),
		options.MaxBackups(10),
		options.MaxSize(30),
		options.Compress(true),
		options.LocalTime(true))
		log.Info("test info")
		
	log.Debug("test debug")
	log.Warn("test warn")
	log.Error("test error")
	log.Panic("test panic")

redis

    r := redis.NewClient(&redis.Options{
		Addr:     "127.0.0.1:6379",
		Password: "", 
		DB:       0,                  
	})
	log.Init(options.LogType(options.Elastic),
		options.RedisClient(r))
	log.Init()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg interface{}, fields ...zap.Field)

func Error

func Error(msg interface{}, fields ...zap.Field)

func Info

func Info(msg interface{}, fields ...zap.Field)

func Init

func Init(opts ...options.Option)

func NewRedisWriter added in v1.0.1

func NewRedisWriter(ctx context.Context, key string, cli *redis.Client) *redisWriter

func Panic

func Panic(msg interface{}, fields ...zap.Field)

func Warn

func Warn(msg interface{}, fields ...zap.Field)

Types

type Logger

type Logger interface {
	Debug(msg interface{}, fields ...zap.Field)
	Info(msg interface{}, fields ...zap.Field)
	Warn(msg interface{}, fields ...zap.Field)
	Error(msg interface{}, fields ...zap.Field)
	Panic(msg interface{}, fields ...zap.Field)
}

func Log added in v1.0.1

func Log() Logger

func NewLog

func NewLog(opts ...options.Option) Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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