zzlog

package module
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: MulanPSL-2.0 Imports: 6 Imported by: 1

README

zzlog

介绍

一个很简单的日志框架,按天分割日志, 支持error,info,debug 3种简单模式 日志同时输出文件和os.Stdout

软件架构

软件架构说明

安装教程
go get gitee.com/douyaye/zzlog
使用说明

直接使用即可,默认日志级别为debug

参考 example/main.go


zzlog.SetIsStdout(true)

// SetLogLevel 设置日志级别
// 	Debug:0
// 	Info:1
// 	Error:2
// 	OFF:3
//  默认值为 Debug:0
zzlog.SetLogLevel(2)



Documentation

Index

Constants

View Source
const (
	LevelDebug = iota
	LevelInfo
	LevelError
	LevelOff
)

Variables

View Source
var (
	Error  = errorLog.Println
	ErrorF = errorLog.Printf
	Info   = infoLog.Println
	InfoF  = infoLog.Printf
	Debug  = debugLog.Println
	DebugF = debugLog.Printf
)

Functions

func Rotate added in v1.3.8

func Rotate()

func SetConfig added in v1.3.3

func SetConfig(c *LogCfg)

func SetFlags added in v1.1.7

func SetFlags(flag int)

SetFlags default flag is (log.LstdFlags|log.Lshortfile|log.Lmsgprefix)

func SetIsStdout added in v1.1.4

func SetIsStdout(b bool)

SetIsStdout 设置是否打印到控制台 默认不打印

func SetLogDir added in v1.1.1

func SetLogDir(dir string)

SetLogDir 设置日志输出目录, 默认 ./zzlog

func SetLogLevel added in v1.1.1

func SetLogLevel(lv int)

SetLogLevel 设置日志级别

	Debug:0
	Info:1
	Error:2
	OFF:3
 默认值为 Debug:0

func SetMaxSize added in v1.3.4

func SetMaxSize(size int)

SetMaxSize 设置文件最大体积(M)

Types

type LogCfg added in v1.3.3

type LogCfg struct {
	MaxSize    int  // 文件大小M
	MaxBackups int  // 保留备份
	MaxAge     int  // 保留天
	Compress   bool // 是否压缩
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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