File: README.md

package info (click to toggle)
golang-github-lunny-log 0.0~git20160921.0.7887c61-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 100 kB
  • sloc: makefile: 6
file content (49 lines) | stat: -rw-r--r-- 921 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## log
[![GoDoc](https://godoc.org/github.com/lunny/log?status.png)](https://godoc.org/github.com/lunny/log)

[简体中文](https://github.com/lunny/log/blob/master/README_CN.md)

# 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:
```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/)