8000 refactor: use async function and support egg@2 by dead-horse · Pull Request #13 · eggjs/logrotator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: use async function and support egg@2 #13

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

Merged
merged 1 commit into from
Nov 10, 2017
Merged

refactor: use async function and support egg@2 #13

merged 1 commit into from
Nov 10, 2017

Conversation

dead-horse
Copy link
Member
Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

@popomore popomore mentioned this pull request Nov 10, 2017
29 tasks
@codecov-io
Copy link
codecov-io commented Nov 10, 2017

Codecov Report

Merging #13 into master will not change coverage.
The diff coverage is 95.45%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #13   +/-   ##
=======================================
  Coverage   95.67%   95.67%           
=======================================
  Files          12       12           
  Lines         185      185           
=======================================
  Hits          177      177           
  Misses          8        8
Impacted Files Coverage Δ
app/lib/rotator.js 97.05% <100%> (ø) ⬆️
app/schedule/clean_log.js 100% <100%> (ø) ⬆️
app/schedule/rotate_by_file.js 100% <100%> (ø) ⬆️
app/schedule/rotate_by_size.js 100% <100%> (ø) ⬆️
app/lib/hour_rotator.js 100% <100%> (ø) ⬆️
app/lib/size_rotator.js 100% <100%> (ø) ⬆️
app/schedule/rotate_by_hour.js 100% <100%> (ø) ⬆️
app/lib/day_rotator.js 81.57% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 333a3e0...fb74c6b. Read the comment docs.

@@ -37,11 +37,11 @@ class DayRotator extends Rotator {
this.app.deprecate('[egg-logrotator] Do not use app.config.logger.rotateLogDirs, only rotate core loggers and custom loggers');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个兼容干掉吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先保留吧,�尽量让这个版本升级减少应用层感知到的 breaking change

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,上面那个 for...in 顺手改掉?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for in 怎么了?

Copy link
Member
10000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是推荐改 for...of 么?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object 不能 for of,而且 node 8 这些性能问题应该也基本都没了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那个是个 Map 来着,可以 for...of map.values()

嗯,那就这样吧

@@ -13,8 +13,8 @@ module.exports = app => {
cron: '0 0 * * *', // run every day at 00:00
},

* task() {
yield rotator.rotate();
async task() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要改为 class 形式呢? @popomore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面非 class 形式的要废掉么?这种简单的不想用 class

Copy link
Member
@atian25 atian25 Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该会一直兼容吧,现在觉得 class 方式写起来不够简洁,那个 static get schedule() {} 挺丑的。。。 ES 还不支持 static const

@dead-horse dead-horse merged commit 6b4e6e5 into master Nov 10, 2017
@dead-horse dead-horse deleted the egg2 branch November 10, 2017 10:04
@dead-horse
Copy link
Member Author

3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0