-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: reload loggers after rotating #5
Conversation
Current coverage is 98.31% (diff: 100%)@@ master #5 diff @@
==========================================
Files 3 5 +2
Lines 111 119 +8
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 109 117 +8
Misses 2 2
Partials 0 0
|
+1 |
多进程覆盖率有问题 |
|
||
module.exports = agent => { | ||
// reload logger to new fd after rotating | ||
agent.messenger.on('log-reload', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
挂在 agent 上的 logger 也需要 reload
1142bf1
to
be632c1
Compare
// reload logger to new fd after rotating | ||
agent.messenger.on('log-reload', () => { | ||
agent.loggers.reload('got log-reload message'); | ||
agent.loggers.coreLogger.info('[egg-logrotator] agent logger reload: got log-reload message'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent.coreLogger 有这个getter的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恩
哦。。这个mr相当于把egg reload的工作交给logrotator做了 |
嗯,logrotator 的功能是插件提供的,那么就应该插件完成。egg 不需要关注 logrotator 的逻辑。 |
@@ -43,7 +43,7 @@ | |||
"test-local": "egg-bin test", | |||
"cov": "egg-bin cov", | |||
"lint": "eslint --ext js --fix test app config *.js", | |||
"ci": "npm run lint && npm run cov", | |||
"ci": "echo $_ && npm run lint && DEBUG=coffee npm run cov", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那这里其他类库也要这样改么? 还有 egg-init 生成的骨架也要.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
后面几个 commit 都是测试
dbd88f9
to
a7cad3a
Compare
终于过了 |
@@ -0,0 +1,9 @@ | |||
'use strict'; | |||
|
|||
module.exports = app => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个就是 codecov/patch
这个还没合? |
这个没问题和掉了? |
ping @fengmk2 |
+1 |
@popomore 发版本吧。 |
|
Checklist
npm test
passesAffected core subsystem(s)
Description of change
将 egg 功能移过来,rotate 后重新 reload loggers