Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

refactor: migrate logger from internal-utils#551

Merged
cawabunga-bytes merged 1 commit into
betafrom
refactor/logger
Jul 23, 2025
Merged

refactor: migrate logger from internal-utils#551
cawabunga-bytes merged 1 commit into
betafrom
refactor/logger

Conversation

@jobotics

@jobotics jobotics commented Jul 21, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added a new debug-level logging method to the logging interface.
  • Refactor

    • Expanded the types of context values supported in logging, allowing for a wider range of data to be included with log messages.

@jobotics jobotics requested a review from cawabunga-bytes July 21, 2025 15:37
@coderabbitai

coderabbitai Bot commented Jul 21, 2025

Copy link
Copy Markdown

Walkthrough

The type alias Contexts in the logger module was broadened to accept additional value types. The ILogger interface received a new debug method, and the noopLogger implementation was updated to include a corresponding no-operation debug function.

Changes

File(s) Summary of Changes
src/logger.ts Expanded Contexts type to allow more value types; added debug method to ILogger and noopLogger

Estimated code review effort

1 (~2 minutes)

Poem

In the meadow where logs are kept,
A debug hop the rabbit leapt.
Contexts grew with types anew,
String and number joined the crew.
With noopLogger calm and still,
The code hops forward, debug at will! 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 41e7079 and 4b9d320.

📒 Files selected for processing (1)
  • src/logger.ts (3 hunks)
🔇 Additional comments (2)
src/logger.ts (2)

18-18: LGTM! Debug method properly added to interface.

The debug method signature is consistent with other logging methods and correctly uses the expanded Contexts type. The placement between verbose and info follows a logical logging level hierarchy.


30-30: LGTM! Correct no-op implementation.

The debug method implementation correctly provides a no-operation function that satisfies the ILogger interface contract and maintains consistency with other no-op methods.

Comment thread src/logger.ts
Comment on lines +6 to +9
export type Contexts = Record<
string,
Context | string | number | boolean | null | undefined
>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Good improvement to context flexibility, but note inconsistency with verbose method.

The expansion of Contexts to include primitive types is beneficial for usability, allowing direct primitive values rather than requiring wrapping in objects. However, there's an inconsistency: the verbose method on line 16 still uses Record<string, unknown> while other logging methods use the new Contexts type.

Consider updating the verbose method for consistency:

- verbose: (message: string, data?: Record<string, unknown>) => void
+ verbose: (message: string, context?: Contexts) => void

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/logger.ts around lines 6 to 9 and line 16, the Contexts type has been
expanded to include primitive types for better flexibility, but the verbose
method still uses Record<string, unknown>, causing inconsistency. Update the
verbose method's parameter type to use the new Contexts type instead of
Record<string, unknown> to maintain consistency across all logging methods.

@cawabunga-bytes cawabunga-bytes merged commit 602e640 into beta Jul 23, 2025
3 checks passed
@cawabunga-bytes cawabunga-bytes deleted the refactor/logger branch July 23, 2025 12:39
cawabunga-bytes added a commit that referenced this pull request Jul 23, 2025
* beta:
  refactor: migrate failover and request utils (#554)
  refactor: migrate publishIntent(s) function (#552)
  refactor: migrate logger from internal-utils (#551)
  refactor: migrate poaBridge utils (#550)
  refactor: use toError and NEP-141 storage utils from internal-utils (#548)
cawabunga-bytes added a commit that referenced this pull request Jul 23, 2025
* beta:
  refactor: migrate runtime and waitForIntentSettlement utils (#553)
  refactor: migrate failover and request utils (#554)
  refactor: migrate publishIntent(s) function (#552)
  refactor: migrate logger from internal-utils (#551)
  refactor: migrate poaBridge utils (#550)
  refactor: use toError and NEP-141 storage utils from internal-utils (#548)
@amdefuse

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0-beta.204 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants