This repository has been archived on 2019-08-27. You can view files and clone it, but cannot push or open issues or pull requests.
gop/vendor/gitea.com/lunny/log
Lunny Xiao c89408c03b
All checks were successful
continuous-integration/drone/push Build is passing
use go mod
2019-05-18 18:16:34 +08:00
..
.gitignore use go mod 2019-05-18 18:16:34 +08:00
dbwriter.go use go mod 2019-05-18 18:16:34 +08:00
filewriter.go use go mod 2019-05-18 18:16:34 +08:00
go.mod use go mod 2019-05-18 18:16:34 +08:00
go.sum use go mod 2019-05-18 18:16:34 +08:00
LICENSE use go mod 2019-05-18 18:16:34 +08:00
logext.go use go mod 2019-05-18 18:16:34 +08:00
README_CN.md use go mod 2019-05-18 18:16:34 +08:00
README.md use go mod 2019-05-18 18:16:34 +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/