glog

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

*

  • 每天流动式日志实现
  • 操作日志记录到文件,支持info,error,debug,notice,alert等
  • 写日志文件的时候,采用乐观锁方式对文件句柄进行加锁
  • 等级参考php Monolog/logger.php
  • 日志切割机制参考lumberjack包实现
  • json encode采用jsoniter库快速json encode处理

Index

Constants

View Source
const (
	EMERGENCY = "emerg"  // 严重错误: 导致系统崩溃无法使用
	ALTER     = "alter"  // 警戒性错误: 必须被立即修改的错误
	CRIT      = "crit"   // 临界值错误: 超过临界值的错误,例如一天24小时,而输入的是25小时这样
	ERR       = "error"  // 一般错误:比如类型错误,数据库连接不上等等
	WARN      = "warn"   // 警告性错误: 需要发出警告的错误
	NOTICE    = "notice" // 通知: 程序可以运行但是还不够完美的错误
	INFO      = "info"   // 信息: 程序输出信息
	DEBUG     = "debug"  // 调试: 调试信息
)

日志级别 从上到下,由高到低

Variables

View Source
var LogLevelMap = map[string]int{
	EMERGENCY: 600,
	ALTER:     550,
	CRIT:      500,
	ERR:       400,
	WARN:      300,
	NOTICE:    250,
	INFO:      200,
	DEBUG:     100,
}

Functions

func AlterLog

func AlterLog(v interface{}, options map[string]interface{})

func CritLog

func CritLog(v interface{}, options map[string]interface{})

func DebugLog

func DebugLog(v interface{}, options map[string]interface{})

func EmergLog

func EmergLog(v interface{}, options map[string]interface{})

func ErrorLog

func ErrorLog(v interface{}, options map[string]interface{})

func InfoLog

func InfoLog(v interface{}, options map[string]interface{})

func LogSize

func LogSize(n int64)

func LogSplit

func LogSplit(b bool)

日志分割设置

func NoticeLog

func NoticeLog(v interface{}, options map[string]interface{})

func RecoverLog

func RecoverLog()

RecoverLog 异常捕获处理,对于异常或者panic进行捕获处理 记录到日志中,方便定位问题

func SetLogDir

func SetLogDir(dir string)

日志存放目录

func SetLogTimeZone

func SetLogTimeZone(timezone string)

设置日志记录时区

func WarnLog

func WarnLog(v interface{}, options map[string]interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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