Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gogap/logrus
DEPRECATED, Please refer to gogap/logrus_mate
https://github.com/gogap/logrus
Last synced: 3 days ago
JSON representation
DEPRECATED, Please refer to gogap/logrus_mate
- Host: GitHub
- URL: https://github.com/gogap/logrus
- Owner: gogap
- License: mit
- Fork: true (sirupsen/logrus)
- Created: 2015-06-28T01:34:38.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T09:45:33.000Z (about 7 years ago)
- Last Synced: 2024-10-31T16:03:32.756Z (11 days ago)
- Language: Go
- Homepage:
- Size: 250 KB
- Stars: 115
- Watchers: 22
- Forks: 29
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## logrus
----DEPRECATED
==========
Please refer to https://github.com/gogap/logrus_mate### example
```
package mainimport (
log "github.com/gogap/logrus"
"github.com/gogap/logrus/hooks/file"
"github.com/gogap/logrus/hooks/graylog"
)func main() {
log.SetFormatter(&log.JSONFormatter{})//输出到graylog
glog, err := graylog.NewHook("boot2docker:9001", "yijifu", nil)
if err != nil {
log.Error(err)
return
}
log.AddHook(glog)//输出到文件
log.AddHook(file.NewHook("logs/ss.log"))
//yijifu组件中的member模块的日志
log.WithField("biz", "member").Errorf("member not login,member is %s", "1001")
}```
## log in file example
```
2015/06/29 15:24:52 [ERROR] member not login,member is 1001
github.com/gogap/test_case/logrus.go:23[biz:membe]```
## log on gray log example
![picture](https://cloud.githubusercontent.com/assets/2741940/8403170/af8b2602-1e74-11e5-8d4b-5029d0e2e00e.png)