Help us shape the future of Go! Take the 2026 Go Developer Survey

ylog

package module
v0.0.0-...-93752ff Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 3 Imported by: 0

README

ylog

ylog是一个简单的日志记录模块,以json格式记录程序日志,日志文件每天切换。根据funny/log修改而来。

例子

package main

import (
	"github.com/yeeuu/ylog"
)

func main(t *testing.T) {
	ylog.Init(".")
	ylog.SetDebug(true)
	ylog.Debug("debug")
	ylog.Error("error", ylog.M{'error': 111})
	ylog.Warning("warning")
	ylog.Info("info")
	ylog.Close()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close 关闭全局日志系统

func Debug

func Debug(msg string, data ...interface{})

Debug 在全局日志中输出调试信息

func Error

func Error(msg string, data ...interface{})

Error 在全局日志中输出错误信息

func Info

func Info(msg string, data ...interface{})

Info 在全局日志中输出信息

func Init

func Init(dir string)

Init 初始化全局日志

func SetDebug

func SetDebug(debug bool)

SetDebug 全局日志开启或关闭调试信息的输出

func Warning

func Warning(msg string, data ...interface{})

Warning 在全局日志中输出警告信息

Types

type L

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

L 日志记录器

func New

func New(dir string) (*L, error)

New 新建一个日志记录器

func (*L) Close

func (logger *L) Close()

Close 关闭日志系统

func (*L) Debug

func (logger *L) Debug(msg string, data ...interface{})

Debug 在日志文件中输出调试信息

func (*L) Error

func (logger *L) Error(msg string, data ...interface{})

Error 在日志文件中输出错误信息

func (*L) Info

func (logger *L) Info(msg string, data ...interface{})

Info 在日志文件中输出信息

func (*L) Log

func (logger *L) Log(msg string, typ string, data ...interface{})

Log 生成jsonlog

func (*L) SetDebug

func (logger *L) SetDebug(debug bool)

SetDebug 开启或关闭调试信息的输出

func (*L) Warning

func (logger *L) Warning(msg string, data ...interface{})

Warning 在日志文件中输出警告信息

type M

type M map[string]interface{}

M 日志数据

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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