Comments (6)
这个hook来自于beego,我做了一下代码的更新,请确认是否可用
https://github.com/astaxie/beego/blob/master/logs/file.go
from logrus_mate.
func (w *fileLogWriter) needRotate(size int, day int) bool {
return (w.MaxLines > 0 && w.maxLinesCurLines >= w.MaxLines) ||
(w.MaxSize > 0 && w.maxSizeCurSize >= w.MaxSize) ||
(w.Daily && day != w.dailyOpenDate)
}
还是没解决问题,因为参数day基本上等于记录日志时刻的时间,跟之前的一样。这个代码比较糙,竟然传了一个没用的参数size。
from logrus_mate.
你可以给他发一个 PR, 然后我再 Fork 过来😅
from logrus_mate.
你可以看看这个hook是否满足你需求,我可以把他兼容过来 https://github.com/rifflock/lfshook
from logrus_mate.
提个思路:现在的情况是例如配置了filename="log",则默认记录的日志都到这个log文件中,是否可以改成记录日志的时候文件名带日期,比如今天是20号,则默认使用log.2018-04-20文件,这样子就可以避免不同日期的日志记录到同个文件的情况
from logrus_mate.
你可以试试rotatelogs
这个writer
(需要更新一下 logrus_mate 的代码)
插件来自于 github.com/lestrrat-go/file-rotatelogs
conf:
import _ "github.com/gogap/logrus_mate/writers/rotatelogs"
out {
name = rotatelogs
options {
path = "logs/access_log.%Y%m%d%H%M"
// rotation-time, max-age, link-name, location
}
}
from logrus_mate.
Related Issues (18)
- License v1 and v2 HOT 3
- 请问graylog的conf应该如何设置?能否举个例子? HOT 5
- 那个example跑不通啊 HOT 1
- 配置了文件存储日志,但是发现控制台同时也输出了日志 HOT 2
- 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 6
- 按日切割和按大小切割同时打开的时候,历史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.