本站源代码
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
Mura Li d77176912b Use Go1.11 module (#5743) 5 年前
..
.gitignore Use Go1.11 module (#5743) 5 年前
LICENSE add other session providers (#5963) 5 年前
README.md Use Go1.11 module (#5743) 5 年前
README_CN.md Use Go1.11 module (#5743) 5 年前
dbwriter.go add other session providers (#5963) 5 年前
filewriter.go add other session providers (#5963) 5 年前
logext.go add other session providers (#5963) 5 年前

README.md

log

GoDoc

简体中文

Installation

go get github.com/lunny/log

Features

  • Add color support for unix console
  • Implemented dbwriter to save log to database
  • Implemented FileWriter to save log to file by date or time.
  • Location configuration

Example

For Single File:

f, _ := os.Create("my.log")
log.Std.SetOutput(f)

For Multiple Writer:

f, _ := os.Create("my.log")
log.Std.SetOutput(io.MultiWriter(f, os.Stdout))

For log files by date or time:

w := log.NewFileWriter(log.FileOptions{
    ByType:log.ByDay,
    Dir:"./logs",
})
log.Std.SetOutput(w)

About

This repo is an extension of Golang log.

LICENSE

BSD License http://creativecommons.org/licenses/BSD/

上海开阖软件有限公司 沪ICP备12045867号-1