feat: add async support to logger methods and update README#24
Conversation
WalkthroughThis update introduces asynchronous support to logger methods across the Changes
Sequence Diagram(s)sequenceDiagram
participant Test
participant Logger
participant Pipeline
Test->>+Logger: await logger.info(message)
Logger->>+Pipeline: await pipeline.execute(message)
Pipeline-->>-Logger: (resolves)
Logger-->>-Test: (resolves Promise)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
.changeset/long-meals-cross.md(1 hunks)README.md(1 hunks)packages/logger-plugin-console/tests/console-plugin.spec.ts(6 hunks)packages/logger-plugin-console/tests/test-utils.ts(0 hunks)packages/logger-plugin-stdout/tests/stdout-plugin.spec.ts(6 hunks)packages/logger-plugin-stdout/tests/test-utils.ts(0 hunks)packages/logger/src/core/logger.ts(7 hunks)packages/logger/src/types/type-logger.ts(1 hunks)packages/logger/tests/ctx.spec.ts(2 hunks)packages/logger/tests/error.spec.ts(1 hunks)packages/logger/tests/logger.spec.ts(6 hunks)packages/logger/tests/test-utils.ts(0 hunks)
💤 Files with no reviewable changes (3)
- packages/logger-plugin-stdout/tests/test-utils.ts
- packages/logger-plugin-console/tests/test-utils.ts
- packages/logger/tests/test-utils.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/logger/src/core/logger.ts (1)
packages/logger/src/types/type-message.ts (1)
RawLoggerMessage(37-39)
packages/logger/src/types/type-logger.ts (1)
packages/logger/src/types/type-message.ts (1)
RawLoggerMessage(37-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: deploy (20.x)
🔇 Additional comments (34)
packages/logger/tests/error.spec.ts (1)
35-39: LGTM! Proper async/await implementation.The logger method calls are now correctly awaited, properly implementing the async support while maintaining the existing error handling test logic.
packages/logger/tests/ctx.spec.ts (2)
31-31: LGTM! Consistent async implementation.The logger method call is now properly awaited, correctly implementing the async support feature while preserving the context testing logic.
75-75: LGTM! Consistent async implementation.The logger method call is now properly awaited, maintaining consistency with the async support implementation across both test cases.
packages/logger-plugin-stdout/tests/stdout-plugin.spec.ts (6)
26-26: LGTM! Proper async implementation for disabled plugin test.The logger method call correctly implements async/await pattern while testing plugin disable functionality.
39-39: LGTM! Consistent async implementation for info level.The logger.info() call is properly awaited, maintaining consistency with the async support feature.
55-59: LGTM! Proper async implementation for warn level.The logger.warn() call with object message is correctly awaited, implementing the async support consistently.
77-81: LGTM! Consistent async implementation for debug level.The logger.debug() call is properly awaited, maintaining consistency with the async support implementation.
99-103: LGTM! Proper async implementation for verbose level.The logger.verbose() call is correctly awaited, implementing the async support feature consistently.
127-131: LGTM! Consistent async implementation for error level.The logger.error() call is properly awaited, completing the comprehensive async support implementation across all log levels.
.changeset/long-meals-cross.md (1)
1-7: LGTM! Properly formatted changeset.The changeset correctly documents the async support feature as patch-level changes across all affected packages with an appropriate description.
packages/logger-plugin-console/tests/console-plugin.spec.ts (6)
24-24: LGTM! Proper async logger usage.The test correctly awaits the logger call, aligning with the new asynchronous logger interface.
37-37: LGTM! Proper async logger usage.The test correctly awaits the logger call, aligning with the new asynchronous logger interface.
53-57: LGTM! Proper async logger usage.The test correctly awaits the logger call, aligning with the new asynchronous logger interface.
75-79: LGTM! Proper async logger usage.The test correctly awaits the logger call, aligning with the new asynchronous logger interface.
97-101: LGTM! Proper async logger usage.The test correctly awaits the logger call, aligning with the new asynchronous logger interface.
125-129: LGTM! Proper async logger usage.The test correctly awaits the logger call, aligning with the new asynchronous logger interface.
packages/logger/tests/logger.spec.ts (6)
5-5: LGTM! Cleanup of unused test utility.The removal of the
sleepimport is appropriate since logger calls are now properly awaited.
50-54: LGTM! Proper async logger usage.All logger method calls are correctly awaited, ensuring proper test execution flow with the new asynchronous interface.
91-95: LGTM! Consistent async pattern.The logger calls are properly awaited across multiple plugins, maintaining test reliability.
141-165: LGTM! Comprehensive async conversion.All object-style logger calls are properly awaited, ensuring the pipeline completes before assertions.
220-243: LGTM! Function message handling with async support.The function-style logger calls are correctly awaited, which is crucial for proper error handling and context resolution.
301-309: LGTM! Pipeline plugin async compatibility.The logger calls in pipeline plugins are properly awaited, maintaining consistency across the logging architecture.
packages/logger/src/core/logger.ts (7)
15-15: LGTM! Fixed interface name typo.The correction from
LogggerTypetoLoggerTypefixes the import reference.
30-30: LGTM! Consistent interface implementation.The class now correctly implements the properly named
LoggerTypeinterface.
157-163: LGTM! Proper async implementation.The
debugmethod is correctly converted to async and awaits the pipeline execution, enabling proper asynchronous logging behavior.
169-175: LGTM! Consistent async pattern.The
infomethod follows the same async pattern as the other logging methods.
181-187: LGTM! Consistent async pattern.The
warnmethod follows the same async pattern as the other logging methods.
193-199: LGTM! Consistent async pattern.The
errormethod follows the same async pattern as the other logging methods.
205-211: LGTM! Consistent async pattern.The
verbosemethod follows the same async pattern as the other logging methods.packages/logger/src/types/type-logger.ts (5)
208-208: LGTM! Core async interface change.The
debugmethod signature correctly returnsPromise<void>to support asynchronous logging operations.
214-214: LGTM! Consistent async interface.The
infomethod signature matches the async pattern established for all logging methods.
220-220: LGTM! Consistent async interface.The
warnmethod signature matches the async pattern established for all logging methods.
226-226: LGTM! Consistent async interface.The
errormethod signature matches the async pattern established for all logging methods.
232-232: LGTM! Consistent async interface.The
verbosemethod signature matches the async pattern established for all logging methods.
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests
Chores