rslog

package module
v0.0.0-...-774ef42 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 1 Imported by: 5

README

rslog

Minimalist log unified interface library. Supports quick access to third-party log components. The default support system and zap log components

极简日志统一接口库. 支持快速接入第三方日志组件. 默认支持系统及zap日志组件

Usage

package main

import (
	"github.com/refitor/rslog"
)

func main() {
	// // zap log
    // rslog.UseLog(zap.New())
	
    // // zap log with file
	// fileWriter := zap.GetZapWriter("demo.log", 30)
	// core := zapcore.NewCore(
	// 	zapcore.NewJSONEncoder(zap.ZapNewEncoderConfig()),
	// 	// zapcore.NewConsoleEncoder(rslog.ZapNewEncoderConfig()),
	// 	zapcore.NewMultiWriteSyncer(os.Stdout, zapcore.AddSync(fileWriter)),
	// 	zaplog.NewAtomicLevelAt(zapcore.InfoLevel),
	// )
	// rslog.ResetLog(zaplog.New(core, zaplog.AddCaller()))

    rslog.Info("test Info")
    rslog.Infof("test Infof: %s", "hello log")

    rslog.Debug("test Debug")
    rslog.Debugf("test Debugf: %s", "hello log")

    rslog.Warn("test Warning")
    rslog.Warnf("test Warningf: %s", "hello log")

    rslog.Error("test Error")
    rslog.Errorf("test Errorf: %s", "hello log")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(datas ...interface{})

func Debugf

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

func Error

func Error(datas ...interface{})

func Errorf

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

func Info

func Info(datas ...interface{})

func Infof

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

func ResetLog

func ResetLog(l interface{})

func SetDepth

func SetDepth(depth int) int

func SetLevel

func SetLevel(l string)

func UseLog

func UseLog(l i_log)

func Warn

func Warn(datas ...interface{})

func Warnf

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

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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