log

package module
v0.0.0-...-a3df976 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

使用默认日志记录器

package main

import (
	log "github.com/fisherzrj/zaplog"
)

func main() {
	// 输出到日志文件
	log.Config.EnableFileOut("./zaplog.log")

	// 开启控制台输出
	log.Config.EnableConsoleOut()

	// 应用当前配置
	log.ApplyConfig()

	log.Info("新日志")
	log.Infof("格式化的日志: %s", "zaplog")
}

创建新日志记录器

package main

import (
	"github.com/fisherzrj/zaplog/logger"
)

func main() {
	log := logger.New()

	// 设置新logger名称,多个logger时可设置用来区分
	log.Config.SetLoggerName("newzaplog")

	// 输出到日志文件
	log.Config.EnableFileOut("./zaplog.log")

	// 开启控制台输出
	log.Config.EnableConsoleOut()

	// 应用当前配置
	log.ApplyConfig()

	log.Info("新日志")
	log.Infof("格式化的日志: %s", "zaplog")
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Config *logger.Config
)

Functions

func ApplyConfig

func ApplyConfig()

ApplyConfig 应用当前Config配置

func DPanic

func DPanic(args ...interface{})

DPanic

func DPanicf

func DPanicf(template string, args ...interface{})

func DPanicln

func DPanicln(args ...interface{})

func DPanicw

func DPanicw(msg string, keysAndValues ...interface{})

func Debug

func Debug(args ...interface{})

Debug

func Debugf

func Debugf(template string, args ...interface{})

func Debugln

func Debugln(args ...interface{})

func Debugw

func Debugw(msg string, keysAndValues ...interface{})

func Error

func Error(args ...interface{})

Error

func Errorf

func Errorf(template string, args ...interface{})

func Errorln

func Errorln(args ...interface{})

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

func Fatal

func Fatal(args ...interface{})

Fatal

func Fatalf

func Fatalf(template string, args ...interface{})

func Fatalln

func Fatalln(args ...interface{})

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

func Info

func Info(args ...interface{})

Info

func Infof

func Infof(template string, args ...interface{})

func Infoln

func Infoln(args ...interface{})

func Infow

func Infow(msg string, keysAndValues ...interface{})

func Panic

func Panic(args ...interface{})

Panic

func Panicf

func Panicf(template string, args ...interface{})

func Panicln

func Panicln(args ...interface{})

func Panicw

func Panicw(msg string, keysAndValues ...interface{})

func PrintSliceOutSlice

func PrintSliceOutSlice()

PrintSliceOutSlice 打印输出到切片的日志

func Warn

func Warn(args ...interface{})

Warn

func Warnf

func Warnf(template string, args ...interface{})

func Warnln

func Warnln(args ...interface{})

func Warnw

func Warnw(msg string, keysAndValues ...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