log

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 8 Imported by: 0

README

日志

设置日志输出位置

log.SetLogFile(name string)

  • name :路径+日志名称, 例: ./

设置日志输出远程UDP 日志服务

log.SetOutService(ip string, port int)

参数

  • ip : 远程ip
  • port : 远程端口

全局关闭日志

log.Close()


关闭日志在终端打印

log.DisableTerminal()


输出

log.Print(args ...interface{})

log.PrintF(format string, args ...interface{})


打印信息,日志带有 [INFO]

log.Info(args ...interface{})

log.InfoF(format string, args ...interface{})

log.InfoTimes(times int, args ...interface{})

参数

  • times: runtime.Caller(times)

打印Debug,日志带有 [DEBUG]

log.Debug(args ...interface{})

log.DebugF(format string, args ...interface{})

log.DebugTimes(times int, args ...interface{})

参数

  • times: runtime.Caller(times)

打印Warn,日志带有 [WARN]

log.Warn(args ...interface{})

log.Warn(format string, args ...interface{})

log.Warn(times int, args ...interface{})

参数

  • times: runtime.Caller(times)

打印Error,日志带有 [ERROR]

log.Error(args ...interface{})

log.Error(format string, args ...interface{})

log.Error(times int, args ...interface{})

参数

  • times: runtime.Caller(times)

打印Panic,日志带有 [PANIC]

log.Panic(args ...interface{})


Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelMap = map[Level]string{
	0: "[Print] ",
	1: "[INFO]  ",
	2: "[DEBUG] ",
	3: "[WARN]  ",
	4: "[ERROR] ",
	5: "[PANIC] ",
	6: "[Http]",
}

Functions

func Close

func Close()

func Debug

func Debug(args ...interface{})

func DebugF

func DebugF(format string, args ...interface{})

func DebugFTimes

func DebugFTimes(times int, format string, args ...interface{})

func DebugTimes

func DebugTimes(times int, args ...interface{})

func DisableTerminal

func DisableTerminal()

func Error

func Error(args ...interface{})

func ErrorF

func ErrorF(format string, args ...interface{})

func ErrorFTimes

func ErrorFTimes(times int, format string, args ...interface{})

func ErrorTimes

func ErrorTimes(times int, args ...interface{})

func HttpInfo

func HttpInfo(args ...interface{})

func Info

func Info(args ...interface{})

func InfoF

func InfoF(format string, args ...interface{})

func InfoFTimes

func InfoFTimes(times int, format string, args ...interface{})

InfoFTimes times 意思是打印第几级函数调用

func InfoTimes

func InfoTimes(times int, args ...interface{})

InfoTimes times 意思是打印第几级函数调用

func Panic

func Panic(args ...interface{})

func Print

func Print(args ...interface{})

func PrintF

func PrintF(format string, args ...interface{})

func SetAppName

func SetAppName(name string)

SetAppName 设置项目名称

func SetLogFile

func SetLogFile(name string)

SetLogFile 设置日志文件名称, 文件名称可含路径(绝对或相对)

func SetOutService

func SetOutService(ip string, port int)

func SetOutServiceInfo2Panic

func SetOutServiceInfo2Panic()

func SetOutServiceWarn2Panic

func SetOutServiceWarn2Panic()

func Warn

func Warn(args ...interface{})

func WarnF

func WarnF(format string, args ...interface{})

func WarnFTimes

func WarnFTimes(times int, format string, args ...interface{})

func WarnTimes

func WarnTimes(times int, args ...interface{})

Types

type Level

type Level int

Jump to

Keyboard shortcuts

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