Logger

package
v0.0.0-...-eedd94a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEBUG = 0
View Source
var ERROR = 5
View Source
var INFO = 3
View Source
var LOGDir = "logs/"

Functions

func Debug

func Debug(format string, v ...interface{})

Debug 默认日志对象方法,记录一条消息日志,需要先初始化

func Debugln

func Debugln(args ...interface{})

Debugln 默认日志对象方法,记录一条调试日志,需要先初始化

func Error

func Error(format string, v ...interface{})

Error 默认日志对象方法,记录一条错误日志,需要先初始化

func Errorln

func Errorln(args ...interface{})

Errorln 默认日志对象方法,记录一条消息日志,需要先初始化

func Info

func Info(format string, v ...interface{})

Info 默认日志对象方法,记录一条消息日志,需要先初始化

func Infoln

func Infoln(args ...interface{})

Infoln 默认日志对象方法,记录一条消息日志,需要先初始化

func InitLogging

func InitLogging(inputfilename string, level int)

InitLogging 初始化默认的日志对象,初始化后,就能使用Error,Info函数记录日志

func PathExists

func PathExists(path string) bool

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func New

func New(filename string, logFilePath bool,
	logFunc bool, level int, runtimeCaller int) *Logger

New 创建一个自己的日志对象。 filename:在logs文件夹下创建的文件名 logFilePath: 日志中记录文件路径 logFunc: 日志中记录调用函数 level: 打印等级。DEBUG, INFO, ERROR runtimeCaller: 文件路径深度,设定适当的值,否则文件路径不正确

func (*Logger) Close

func (logobj *Logger) Close() error

Close 关闭这一个日志对象

func (*Logger) Debug

func (logobj *Logger) Debug(format string, v ...interface{})

Debug 记录一条消息日志

func (*Logger) Debugln

func (logobj *Logger) Debugln(args ...interface{})

Debugln 打印一行调试日志

func (*Logger) Error

func (logobj *Logger) Error(format string, v ...interface{})

Error 记录一条错误日志

func (*Logger) Errorln

func (logobj *Logger) Errorln(args ...interface{})

Errorln 打印一行错误日志

func (*Logger) Info

func (logobj *Logger) Info(format string, v ...interface{})

Info 记录一条消息日志

func (*Logger) Infoln

func (logobj *Logger) Infoln(args ...interface{})

Infoln 打印一行消息日志

Jump to

Keyboard shortcuts

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