-
-
Notifications
You must be signed in to change notification settings - Fork 28
fix: store log timestamps in ISO format #333
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
Conversation
WalkthroughThe ApiLogsTransport.log method now normalizes timestamps to ISO string format using Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/unit/lib/api-logs-transport.test.ts (1)
11-11: Add test coverage for edge cases in timestamp handling.The tests only cover the happy path where a valid timestamp is always provided. Consider adding tests for:
- Logger without
timestampindefaultMeta(timestamp undefined)- Invalid timestamp formats that fail to parse
- Null or malformed timestamp values
This would catch the missing error handling in the production code.
Example test to add:
it('should handle missing timestamp gracefully', async () => { const transport = new ApiLogsTransport({ isActive: true, sendInterval: 100, socket }); const logger = winston.createLogger({ transports: [transport] }); // No defaultMeta logger.info('test'); await sandbox.clock.tickAsync(1000); const payload = socket.emitWithAck.firstCall.args[1]; expect(payload.logs[0]).to.have.property('timestamp'); expect(payload.logs[0].timestamp).to.match(/^\d{4}-\d{2}-\d{2}T/); // ISO format });Also applies to: 24-24, 71-71, 135-135
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/lib/api-logs-transport.ts(1 hunks)test/unit/lib/api-logs-transport.test.ts(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{vue,ts,js}
⚙️ CodeRabbit configuration file
We use Nuxt with auto imports enabled. Don't warn about missing imports.
Files:
src/lib/api-logs-transport.tstest/unit/lib/api-logs-transport.test.ts
⏰ 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). (8)
- GitHub Check: Test docker / Publish Docker image
- GitHub Check: Test code / Run tests (22.x)
- GitHub Check: Test code / Run tests (20.x)
- GitHub Check: Test code / Run e2e tests (20.x)
- GitHub Check: Test code / Run tests (20.x)
- GitHub Check: Test code / Run tests (18.x)
- GitHub Check: Test code / Run e2e tests (20.x)
- GitHub Check: Test docker / Publish Docker image
|
🎉 This PR is included in version 0.41.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.