Comments (6)
hooks/file 这个也是写文件log,按天记录的,你可以看看是否满足你需求
建议你是写hook,而不是写一个 writer, 因为 hook 能支持较为复杂的逻辑
from logrus_mate.
loggers的配置如下:
{ "name": "logger", "config": { "development": { "out": { "name": "stdout", "options": {} }, "level": "debug", "formatter": { "name": "json" }, "hooks": [ { "name": "file", "options": { "filename": "1.log", "maxlines": 1000, "maxsize": 1024, "daily": true, "maxdays": 7, "rotate": true, "level": 3 } } ] } } }
hooks/file配置怎么额外有个level,没使用全局的level?
另外1.log记录的日志没使用定义的json格式
[-] 2016/05/31 13:35:44 [ERROR] 111 /home/wjb/Document/go/src/repo.gokuai.cn/gokuai/webhook/logger/logger.go:57 [-] 2016/05/31 13:35:44 [INFO] 222 /home/wjb/Document/go/src/repo.gokuai.cn/gokuai/webhook/logger/logger.go:41
from logrus_mate.
这个是指 file
这个插件在什么级别以上才输出,因为 logrus 本身是支持多插件执行的,那么插件本身可以做level的判断
from logrus_mate.
恩,看到其它几个hook没有level,file有感觉奇怪
file的输出格式不是json,这个是什么原因?
from logrus_mate.
这个插件是别人移植的,本身只支持行格式的,比较简易,但是够用
from logrus_mate.
好吧,我再实现个hook好了
from logrus_mate.
Related Issues (18)
- License v1 and v2 HOT 3
- 请问graylog的conf应该如何设置?能否举个例子? HOT 5
- 那个example跑不通啊 HOT 1
- 配置了文件存储日志,但是发现控制台同时也输出了日志 HOT 2
- 按日切割功能有缺陷 HOT 6
- Is logrus_mate support watching and re-reading config files? HOT 1
- About sirupsen and Sirupsen, different from release and master HOT 1
- 按日切割和按大小切割同时打开的时候,历史Log日期错误 HOT 2
- file hook level定义不统一
- Bump version for Go 1.11 module HOT 1
- file hook的例子mate.conf存在问题,级别leve建议按照不同的hook进行配置
- When I pass a name to logger it breaks with nil pointer HOT 1
- how to set config directly rather than string or file HOT 2
- Update Logstash dependency
- What purpose of using hijack mode? HOT 3
- 如何按天生成日志文件? HOT 1
- name conflict with Logrus HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logrus_mate.