mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-15 05:58:16 +00:00
70ea2300ca
* Vendor: update gitea.com/macaron/session to a177a270 * make vendor * Vendor: update gitea.com/macaron/macaron to 0db5d458 * make vendor * Vendor: update gitea.com/macaron/cache to 905232fb * make vendor * Vendor: update gitea.com/macaron/i18n to 4ca3dd0c * make vendor * Vendor: update gitea.com/macaron/gzip to efa5e847 * make vendor * Vendor: update gitea.com/macaron/captcha to e8597820 * make vendor
52 lines
1 KiB
Markdown
Vendored
52 lines
1 KiB
Markdown
Vendored
## log
|
|
|
|
[![](https://goreportcard.com/badge/gitea.com/lunny/log)](https://goreportcard.com/report/gitea.com/lunny/log)
|
|
[![GoDoc](https://godoc.org/gitea.com/lunny/log?status.png)](https://godoc.org/gitea.com/lunny/log)
|
|
|
|
[简体中文](https://gitea.com/lunny/log/blob/master/README_CN.md)
|
|
|
|
# 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:
|
|
```Go
|
|
f, _ := os.Create("my.log")
|
|
log.Std.SetOutput(f)
|
|
```
|
|
|
|
For Multiple Writer:
|
|
```Go
|
|
f, _ := os.Create("my.log")
|
|
log.Std.SetOutput(io.MultiWriter(f, os.Stdout))
|
|
```
|
|
|
|
For log files by date or time:
|
|
```Go
|
|
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/](http://creativecommons.org/licenses/BSD/)
|