Skip to content
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

fix: use @eggjs/logrotator #5390

Merged
merged 3 commits into from
Feb 3, 2025
Merged

fix: use @eggjs/logrotator #5390

merged 3 commits into from
Feb 3, 2025

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Feb 3, 2025

Summary by CodeRabbit

  • Chores
    • Removed an automated contributor welcome workflow and updated the logging dependency.
  • Documentation
    • Refined documentation links and descriptions to reflect the updated logging system.
  • Refactor
    • Adjusted configuration settings for improved integration of the enhanced logging rotation.
  • Tests
    • Enhanced test coverage to validate the updated log rotation functionality.

Copy link

coderabbitai bot commented Feb 3, 2025

Walkthrough

This pull request removes a deprecated GitHub Actions workflow and an unused module import while updating the logging implementation. The dependency for log rotation has been shifted from egg-logrotator (^3.2.0) to @eggjs/logrotator (^4.0.0) in the package configuration. References in configuration files, documentation (both English and Chinese), and test files have been updated accordingly. Additionally, new test scaffolding—featuring a MyLogRotator class extension with type checks—has been introduced along with revised import paths in the test suite.

Changes

File(s) Change Summary
.github/.../pr-contributor-welcome.yml
index-old.d.ts
Removed the GitHub Actions workflow for welcoming PR contributors and eliminated the import for egg-logrotator.
package.json
site/.../plugin.md
site/.../plugin.zh-CN.md
site/.../logger.md
site/.../logger.zh-CN.md
src/config/plugin.ts
src/lib/types.ts
Updated logging dependency from egg-logrotator (^3.2.0) to @eggjs/logrotator (^4.0.0) with corresponding changes in documentation links, package configurations, and import statements.
test/index.test-d.ts
test/lib/plugins/logrotator.test.ts
Added a new MyLogRotator class extending LogRotator with an asynchronous method and type assertions; updated test import paths and added debugging logs.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Suite
    participant ML as MyLogRotator
    participant LR as LogRotator (base)

    Test->>ML: Instantiate MyLogRotator
    Test->>ML: Invoke getRotateFiles()
    ML-->>Test: Return empty Map
Loading

Poem

I'm a bunny with a joyful hop,
Old workflows and imports now drop.
Dependencies updated, docs anew,
Tests and types dance in view.
With carrots and logs, I cheer and prance—
A fresh code garden, join the dance!
🥕🐰

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.95%. Comparing base (762e301) to head (15a5007).
Report is 2 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #5390   +/-   ##
=======================================
  Coverage   94.94%   94.95%           
=======================================
  Files          40       40           
  Lines        3741     3746    +5     
  Branches      354      353    -1     
=======================================
+ Hits         3552     3557    +5     
  Misses        189      189           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/lib/plugins/logrotator.test.ts (1)

22-22: Remove debug console.log statement.

This console.log statement appears to be for debugging purposes and should be removed before merging.

-    console.log(files);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb36fca and 749e7dc.

📒 Files selected for processing (11)
  • .github/workflows/pr-contributor-welcome.yml (0 hunks)
  • index-old.d.ts (0 hunks)
  • package.json (1 hunks)
  • site/docs/basics/plugin.md (1 hunks)
  • site/docs/basics/plugin.zh-CN.md (1 hunks)
  • site/docs/core/logger.md (2 hunks)
  • site/docs/core/logger.zh-CN.md (2 hunks)
  • src/config/plugin.ts (1 hunks)
  • src/lib/types.ts (1 hunks)
  • test/index.test-d.ts (2 hunks)
  • test/lib/plugins/logrotator.test.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • index-old.d.ts
  • .github/workflows/pr-contributor-welcome.yml
✅ Files skipped from review due to trivial changes (4)
  • site/docs/basics/plugin.zh-CN.md
  • site/docs/basics/plugin.md
  • site/docs/core/logger.md
  • site/docs/core/logger.zh-CN.md
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: Node.js / Test (windows-latest, 22)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 18)
  • GitHub Check: Node.js / Test (ubuntu-latest, 22)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18)
  • GitHub Check: Node.js / Test (macos-latest, 22)
  • GitHub Check: Node.js / Test (macos-latest, 20)
  • GitHub Check: Node.js / Test (macos-latest, 18)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 18)
  • GitHub Check: Node.js / Test (windows-latest, 18)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 22)
  • GitHub Check: Node.js / Test (ubuntu-latest, 22)
🔇 Additional comments (5)
test/lib/plugins/logrotator.test.ts (1)

17-17: LGTM!

The import path has been correctly updated to use the new @eggjs/logrotator package.

src/config/plugin.ts (1)

86-86: LGTM!

The package name has been correctly updated to use the new @eggjs/logrotator package, maintaining consistency with other @eggjs packages in the configuration.

test/index.test-d.ts (1)

3-3: LGTM!

The changes enhance type safety by:

  1. Adding proper import for the LogRotator class
  2. Adding a test class extending LogRotator
  3. Adding comprehensive type expectations for logrotator configuration properties

Also applies to: 73-86

src/lib/types.ts (1)

29-29: LGTM!

The import for @eggjs/logrotator has been correctly added, following the same pattern as other plugin imports.

package.json (1)

28-28: Updated Logrotator Dependency

The dependency for log rotation has been updated to use @eggjs/logrotator with version ^4.0.0, replacing the deprecated egg-logrotator package. This change aligns with the updated logging implementation and ensures the project uses the supported package going forward.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/lib/egg.ts (1)

132-137: Consider enhancing the JSDoc for the Boot property.

The documentation could be more explicit about Boot being an alias of BaseHookClass. Consider adding more context about when to use Boot vs BaseHookClass.

  /**
   * Retrieve base boot
-  * @member {Boot}
-  * @alias BaseHookClass
+  * @member {Boot} Boot - An alias of BaseHookClass, used for boot lifecycle hooks
+  * @see BaseHookClass
   */
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 749e7dc and 15a5007.

📒 Files selected for processing (1)
  • src/lib/egg.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 22)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 18)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 22)
  • GitHub Check: Node.js / Test (windows-latest, 18)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18)
  • GitHub Check: Node.js / Test (macos-latest, 22)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18)
  • GitHub Check: Node.js / Test (windows-latest, 22)
  • GitHub Check: Node.js / Test (macos-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 22)
  • GitHub Check: Node.js / Test (macos-latest, 18)
  • GitHub Check: Node.js / Test (windows-latest, 20)
  • GitHub Check: Node.js / Test (windows-latest, 18)
  • GitHub Check: Node.js / Test (ubuntu-latest, 20)
  • GitHub Check: Node.js / Test (ubuntu-latest, 18)
🔇 Additional comments (3)
src/lib/egg.ts (3)

119-124: LGTM! Well-documented subscription property.

The Subscription property is well-documented with version information and clear purpose.

Also applies to: 701-701


126-130: LGTM! Clear base hook class implementation.

The BaseHookClass property is properly implemented and documented.

Also applies to: 702-702


686-704: LGTM! Interface declaration is consistent.

The interface declaration in the module augmentation correctly mirrors the class properties.

@fengmk2 fengmk2 merged commit 351a022 into next Feb 3, 2025
33 of 34 checks passed
@fengmk2 fengmk2 deleted the use-@eggjs/logrotator branch February 3, 2025 13:35
fengmk2 pushed a commit that referenced this pull request Feb 3, 2025
[skip ci]

## [4.0.6](v4.0.5...v4.0.6) (2025-02-03)

### Bug Fixes

* use @eggjs/logrotator ([#5390](#5390)) ([351a022](351a022))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant