A compatible log extension
Go to file
Lunny Xiao 01b5df579c
go mod support
2019-03-22 13:31:10 +08:00
.gitignore add license 2016-09-21 13:09:05 +08:00
dbwriter.go filewriter for log by date or time 2015-04-03 14:32:33 +08:00
filewriter_test.go some improvements for filewriter 2015-11-24 22:35:22 +08:00
filewriter.go some improvements for filewriter 2015-11-24 22:35:22 +08:00
go.mod go mod support 2019-03-22 13:31:10 +08:00
go.sum go mod support 2019-03-22 13:31:10 +08:00
LICENSE add license 2016-09-21 13:09:05 +08:00
logext_test.go add log level Lall and Lnone 2014-05-28 11:18:37 +08:00
logext.go some improvements for filewriter 2015-11-24 22:35:22 +08:00
README_CN.md add goreport badge 2019-03-21 16:18:03 +08:00
README.md add goreport badge 2019-03-21 16:18:03 +08:00

log

GoDoc

简体中文

Installation

go get gitea.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/