Skip to content

Conversation

ardatan
Copy link
Owner

@ardatan ardatan commented Feb 12, 2025

image

Logger interface changes that exposed to the user in case of custom logging;

  • Now child method of Logger accepts an object.

So in Hive Gateway we can implement our JSON-based logger.

DefaultLogger text-based prettified logger implementation for Logger interface;

  • DefaultLogger implementation prints key value pairs as [key=value]
  • Timestamp is shown as [timestamp=XXX]
  • Most of child usages are now key=value instead of single string such as [requestId=XXX]

Summary by CodeRabbit

  • New Features

    • Updated the identifiers for GraphQL movie search operations so that queries and subscriptions are now clearly distinguished.
  • Refactor

    • Enhanced log output by switching from simple text formatting to structured, object-based messages for improved clarity.
    • Standardized logger configurations across the system to ensure better traceability and readability in logs.

Copy link
Contributor

coderabbitai bot commented Feb 12, 2025

📝 Walkthrough

Walkthrough

This pull request introduces patches across multiple GraphQL Mesh and OmniGraph packages. The updates primarily focus on refining logging practices by switching from string-based to object-based logger contexts, adjusting logger prefixes, and improving log formatting. In addition, the pull request renames specific GraphQL query and subscription identifiers to enhance clarity. Several configuration functions are also updated to accept a logger instance, ensuring a more consistent logging experience across the codebase.

Changes

File(s) Change Summary
@graphql-mesh/merger-bare, @omnigraph/json-schema, @graphql-mesh/plugin-http-cache, @graphql-mesh/transport-grpc, @graphql-mesh/transport-rest, @graphql-mesh/runtime, @graphql-mesh/config, @graphql-mesh/types, @graphql-mesh/utils, @omnigraph/grpc, @graphql-mesh/compose-cli, @graphql-mesh/cli Patched multiple packages to update logging outputs and enhance log clarity.
examples/grpc-example/.../MoviesByCast.stream.graphql,
examples/grpc-example/.../MoviesByCast.subscription.graphql
Renamed GraphQL query and subscription identifiers (appending "Query" and "Subscription").
packages/compose-cli/src/getComposedSchemaFromConfig.ts,
packages/compose-cli/src/run.ts
Revised logger instantiation: changed string interpolation to object notation and removed extra whitespace.
packages/legacy/cli/src/commands/serve/serve.ts Updated logging in worker exit and termination event handlers using object-based context.
packages/legacy/cli/src/config.ts,
packages/legacy/cli/src/index.ts,
packages/legacy/config/src/process.ts,
packages/legacy/config/src/utils.ts
Enhanced logger configuration and initialization defaults; modified function signatures to accept a logger instance.
packages/legacy/mergers/bare/src/index.ts,
packages/legacy/runtime/src/get-mesh.ts
Modified logger.child calls from string to object notation to provide more structured context.
packages/legacy/types/src/index.ts Expanded Logger.child method signature to accept both strings and object contexts.
packages/legacy/utils/src/in-context-sdk.ts,
packages/legacy/utils/src/logger.ts,
packages/legacy/utils/src/wrapFetchWithHooks.ts
Updated logger and addPrefix methods; added helper for name stringification and transitioned to object-based parameters.
packages/loaders/grpc/src/grpcLoaderHelper.ts,
packages/loaders/json-schema/src/getDereferencedJSONSchemaFromOperations.ts
Improved logger parameter passing in loaders for clearer context propagation.
packages/plugins/http-cache/src/index.ts,
packages/transports/grpc/src/index.ts,
packages/transports/rest/src/directives/httpOperation.ts,
packages/transports/rest/src/directives/pubsubOperation.ts
Refined logger instantiations to use object contexts; adjusted debug message formats for clarity in plugins and transport modules.

Possibly related PRs

  • Upcoming Release Changes #8352: Addresses updates in the @graphql-mesh/transport-rest package’s logging mechanism, similar to the revisions made here.

Poem

I'm a bunny hopping through the code,
Where logs now shine with clearer mode.
From strings to objects, each log is neat,
Query names and errors, all in sync and sweet.
With carrots 🥕 and a joyful cheer,
I celebrate these changes far and near!
Hop on!

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/legacy/cli/src/commands/serve/serve.ts

Oops! Something went wrong! :(

ESLint: 9.20.1

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

packages/legacy/utils/src/logger.ts

Oops! Something went wrong! :(

ESLint: 9.20.1

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

packages/legacy/types/src/index.ts

Oops! Something went wrong! :(

ESLint: 9.20.1

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 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
Contributor

github-actions bot commented Feb 12, 2025

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🟢
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link
Contributor

github-actions bot commented Feb 12, 2025

💻 Website Preview

The latest changes are available as preview in: https://5d6452c6.graphql-mesh.pages.dev

Copy link
Contributor

@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)
packages/legacy/mergers/bare/src/index.ts (1)

25-25: Consider adding merger type to debug message.

While the change to object-based logging is good, consider enhancing the debug message on line 23 to include the merger type transition in a structured format.

-    this.options.logger.debug(
-      `Switching to Stitching merger due to the transforms and additional resolvers`,
-    );
+    this.options.logger.debug('Switching merger type', {
+      from: this.name,
+      to: 'stitching',
+      reason: 'transforms and additional resolvers'
+    });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b243fc4 and 6167fff.

📒 Files selected for processing (22)
  • .changeset/heavy-swans-act.md (1 hunks)
  • examples/grpc-example/example-queries/MoviesByCast.stream.graphql (1 hunks)
  • examples/grpc-example/example-queries/MoviesByCast.subscription.graphql (1 hunks)
  • packages/compose-cli/src/getComposedSchemaFromConfig.ts (1 hunks)
  • packages/compose-cli/src/run.ts (1 hunks)
  • packages/legacy/cli/src/commands/serve/serve.ts (3 hunks)
  • packages/legacy/cli/src/config.ts (5 hunks)
  • packages/legacy/cli/src/index.ts (4 hunks)
  • packages/legacy/config/src/process.ts (8 hunks)
  • packages/legacy/config/src/utils.ts (1 hunks)
  • packages/legacy/mergers/bare/src/index.ts (1 hunks)
  • packages/legacy/runtime/src/get-mesh.ts (2 hunks)
  • packages/legacy/types/src/index.ts (1 hunks)
  • packages/legacy/utils/src/in-context-sdk.ts (2 hunks)
  • packages/legacy/utils/src/logger.ts (6 hunks)
  • packages/legacy/utils/src/wrapFetchWithHooks.ts (1 hunks)
  • packages/loaders/grpc/src/grpcLoaderHelper.ts (2 hunks)
  • packages/loaders/json-schema/src/getDereferencedJSONSchemaFromOperations.ts (1 hunks)
  • packages/plugins/http-cache/src/index.ts (1 hunks)
  • packages/transports/grpc/src/index.ts (1 hunks)
  • packages/transports/rest/src/directives/httpOperation.ts (1 hunks)
  • packages/transports/rest/src/directives/pubsubOperation.ts (2 hunks)
✅ Files skipped from review due to trivial changes (7)
  • examples/grpc-example/example-queries/MoviesByCast.stream.graphql
  • examples/grpc-example/example-queries/MoviesByCast.subscription.graphql
  • packages/transports/grpc/src/index.ts
  • packages/compose-cli/src/run.ts
  • packages/plugins/http-cache/src/index.ts
  • .changeset/heavy-swans-act.md
  • packages/loaders/grpc/src/grpcLoaderHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: unit / node 22
  • GitHub Check: integration / node 22
  • GitHub Check: unit / node 20
  • GitHub Check: integration / node 20
  • GitHub Check: unit / node 18
  • GitHub Check: integration / node 18
  • GitHub Check: release / snapshot
  • GitHub Check: e2e / node v22
  • GitHub Check: e2e / node v20
  • GitHub Check: e2e / node v18
  • GitHub Check: deployment
  • GitHub Check: check
🔇 Additional comments (26)
packages/transports/rest/src/directives/pubsubOperation.ts (2)

21-21: LGTM! Improved logger context structure.

The change from string-based to object-based logger context enhances log clarity and searchability.

Also applies to: 40-40


41-41: LGTM! Enhanced debug message structure.

The debug message now uses a more structured format with object parameters, improving log parsing and readability.

packages/loaders/json-schema/src/getDereferencedJSONSchemaFromOperations.ts (1)

34-34: LGTM! Proper logger propagation.

Adding the logger parameter ensures consistent logging context throughout the JSON schema dereferencing process.

packages/legacy/utils/src/wrapFetchWithHooks.ts (1)

52-52: LGTM! Enhanced request tracing.

Converting requestId to an object parameter improves request tracing and log filtering capabilities.

packages/legacy/utils/src/logger.ts (4)

78-78: LGTM! Improved log message structure.

The log message format has been enhanced to use consistent key-value pairs for timestamp and log level, making logs more structured and easier to parse.

Also applies to: 88-88, 99-99, 110-110, 122-122


128-139: LGTM! Enhanced child logger flexibility.

The child method now accepts both string and object inputs, providing more flexibility in log context creation while maintaining backward compatibility.


141-147: LGTM! Enhanced prefix flexibility.

The addPrefix method now accepts both string and object inputs, consistent with the child method changes.


154-163: LGTM! Well-implemented name formatting.

The stringifyName function effectively handles both string and object inputs, producing consistent key-value pair output.

packages/legacy/cli/src/commands/serve/serve.ts (2)

107-107: LGTM! Enhanced worker logging.

Worker ID is now logged using a structured object format, improving log clarity and consistency.


128-129: LGTM! Improved termination event logging.

Termination events are now logged using a structured object format, enhancing log readability and consistency.

Also applies to: 152-156

packages/legacy/cli/src/config.ts (3)

16-16: LGTM! Improved logger flexibility in config validation.

The validateConfig function now accepts an optional logger parameter, allowing for consistent logger usage across the application.

Also applies to: 36-36


63-63: LGTM! Enhanced logger initialization.

Default logger initialization has been simplified by removing the emoji prefix, and the logger parameter is now properly passed through the configuration chain.

Also applies to: 102-104


147-147: LGTM! Consistent logger initialization in custom loader.

The custom loader's logger initialization aligns with the new default empty prefix pattern.

packages/compose-cli/src/getComposedSchemaFromConfig.ts (1)

42-42: LGTM! Enhanced subgraph logging.

Subgraph logging now uses a structured object format, improving log clarity and consistency with the new logging patterns.

packages/legacy/config/src/utils.ts (1)

261-261: LGTM! Improved logger prefix configuration.

Removing the default emoji prefix in favor of an empty string enhances logging clarity and provides more flexibility in prefix configuration.

packages/legacy/types/src/index.ts (1)

225-225: LGTM! Enhanced logger child method signature.

The updated signature allows for structured key-value pair logging while maintaining backward compatibility with string inputs. This change improves log clarity and aligns with modern logging practices.

packages/legacy/runtime/src/get-mesh.ts (2)

106-106: LGTM! Consistent logger initialization.

Removing the emoji prefix aligns with the updated logger configuration pattern, maintaining consistency across the codebase.


166-166: LGTM! Improved source logging structure.

Using an object with a source key for child loggers enhances log readability and searchability.

packages/legacy/utils/src/in-context-sdk.ts (2)

52-52: LGTM! Structured source logging.

Using an object with a source key for the raw source logger improves log clarity and consistency.


86-88: LGTM! Enhanced SDK logging structure.

The structured format for in-context SDK logging with the inContextSdk key improves log organization and readability.

packages/transports/rest/src/directives/httpOperation.ts (1)

103-106: LGTM! Enhanced logging clarity.

The changes improve logging by:

  1. Using structured key-value pairs for better log parsing
  2. Removing unnecessary arrow symbol for cleaner output
packages/legacy/cli/src/index.ts (2)

46-46: LGTM! Simplified logger prefix.

Removing the emoji prefix makes logs cleaner and more consistent.


306-306: LGTM! Enhanced logging configuration.

Consistently passing the logger instance to findAndParseConfig ensures uniform logging behavior across different operations.

Also applies to: 391-391, 460-460

packages/legacy/config/src/process.ts (3)

11-11: LGTM! Added logger type and configuration option.

The addition of the Logger type import and logger option to ConfigProcessOptions enhances type safety and configuration flexibility.

Also applies to: 65-65


223-223: LGTM! Standardized structured logging.

The changes consistently use object-based contexts for logging across sources, plugins, and handlers, improving log clarity and searchability.

Also applies to: 235-235, 379-379, 403-403, 415-415


561-562: LGTM! Enhanced merger logging.

The changes improve merger logging by:

  1. Using structured key-value pairs
  2. Consistently applying the same logging pattern as other components

Also applies to: 569-570

Copy link
Contributor

github-actions bot commented Feb 12, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/cache-cfw-kv 0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-file 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-inmemory-lru 0.0.12-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-localforage 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-redis 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-upstash-redis 0.0.3-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/compose-cli 1.3.10-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-composition 0.7.22-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/include 0.2.15-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/apollo-link 0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/cli 0.98.22-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/config 0.106.22-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/graphql 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/grpc 0.107.7-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/json-schema 0.108.19-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/mongoose 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/mysql 0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/neo4j 0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/odata 0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/openapi 0.108.20-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/postgraphile 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/raml 0.108.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/soap 0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/supergraph 0.9.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/thrift 0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/tuql 0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/http 0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-bare 0.104.19-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-stitching 0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/migrate-config-cli 1.4.14-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/runtime 0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/store 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-cache 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-encapsulate 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-extend 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-federation 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-filter-schema 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hive 0.103.19-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hoist-field 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-naming-convention 0.103.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prefix 0.103.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prune 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rate-limit 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rename 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-replace-field 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-resolvers-composition 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-transfer-schema 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-type-merging 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/types 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/urql-exchange 0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/utils 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/grpc 0.2.4-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/json-schema 0.108.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/mysql 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/neo4j 0.9.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/odata 0.1.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/openapi 0.108.20-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/raml 0.108.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/soap 0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/sqlite 0.7.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@omnigraph/thrift 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-deduplicate-request 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-hive 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-cache 0.104.4-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-details-extensions 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jit 0.1.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-jwt-auth 1.4.6-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-live-query 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-mock 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-newrelic 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-field-permissions 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-headers 1.3.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-rate-limit 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-response-cache 0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-snapshot 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-statsd 0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-grpc 0.2.6-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-mysql 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-neo4j 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-odata 0.1.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-rest 0.8.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-soap 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-sqlite 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-thrift 0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 npm ↗︎ unpkg ↗︎

Copy link
Contributor

@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 (4)
packages/legacy/utils/src/logger.ts (4)

78-78: Standardize spacing after level indicators.

There's inconsistent spacing after level indicators across different log methods:

  • [level=WARN] (2 spaces)
  • [level=INFO] (2 spaces)
  • [level=ERROR] (1 space)
  • [level=DEBUG] (1 space)

Apply this diff to standardize the spacing:

-      `[timestamp=${getTimestamp()}] [level=WARN]  ${this.prefix}${ANSI_CODES.orange}`,
-      `[timestamp=${getTimestamp()}] [level=INFO]  ${this.prefix}${ANSI_CODES.cyan}`,
+      `[timestamp=${getTimestamp()}] [level=WARN] ${this.prefix}${ANSI_CODES.orange}`,
+      `[timestamp=${getTimestamp()}] [level=INFO] ${this.prefix}${ANSI_CODES.cyan}`,

Also applies to: 88-88, 99-99, 110-110, 122-122


128-139: Enhance TypeScript types and documentation.

Consider adding JSDoc comments and more specific types for better developer experience.

Apply this diff:

-  child(name: string | Record<string, string | number>): Logger {
+  /**
+   * Creates a child logger with additional context
+   * @param name - Logger context as string or key-value pairs
+   * @example
+   * // String context
+   * logger.child('UserService')
+   * // Key-value context
+   * logger.child({ userId: '123', action: 'login' })
+   */
+  child(name: string | { [K in string]: string | number }): Logger {

141-147: Enhance TypeScript types and documentation for addPrefix.

Similar to the child method, consider adding JSDoc comments and more specific types.

Apply this diff:

-  addPrefix(prefix: string | Record<string, string | number>): Logger {
+  /**
+   * Adds a prefix to the current logger
+   * @param prefix - Prefix as string or key-value pairs
+   * @example
+   * // String prefix
+   * logger.addPrefix('Worker')
+   * // Key-value prefix
+   * logger.addPrefix({ workerId: '123' })
+   */
+  addPrefix(prefix: string | { [K in string]: string | number }): Logger {

154-163: Enhance stringifyName function with validation and documentation.

The function could be more robust with input validation and handle edge cases better.

Apply this diff:

+/**
+ * Formats a name into a log-friendly string
+ * @param name - String, number, or key-value pairs to format
+ * @returns Formatted string in [key=value] format
+ * @throws {Error} If name is null or undefined
+ */
 function stringifyName(name: string | Record<string, string | number>) {
+  if (name == null) {
+    throw new Error('Name cannot be null or undefined');
+  }
+
   if (typeof name === 'string' || typeof name === 'number') {
     return `[${name}]`;
   }
+
+  if (Object.keys(name).length === 0) {
+    throw new Error('Object cannot be empty');
+  }
+
   const names: string[] = [];
   for (const [key, value] of Object.entries(name)) {
+    if (value == null) {
+      throw new Error(`Value for key "${key}" cannot be null or undefined`);
+    }
     names.push(`${key}=${value}`);
   }
   return `[${names.join(', ')}]`;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6167fff and 31f05e0.

📒 Files selected for processing (3)
  • packages/legacy/cli/src/commands/serve/serve.ts (3 hunks)
  • packages/legacy/types/src/index.ts (1 hunks)
  • packages/legacy/utils/src/logger.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/legacy/types/src/index.ts
  • packages/legacy/cli/src/commands/serve/serve.ts
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: integration / node 22
  • GitHub Check: integration / node 20
  • GitHub Check: e2e / node v22
  • GitHub Check: integration / node 18
  • GitHub Check: e2e / node v20
  • GitHub Check: e2e / node v18
  • GitHub Check: unit / node 22
  • GitHub Check: unit / node 20
  • GitHub Check: apollo-federation-compatibility
  • GitHub Check: release / snapshot
  • GitHub Check: unit / node 18
  • GitHub Check: deployment
  • GitHub Check: check
  • GitHub Check: Analyze (javascript-typescript)

@ardatan ardatan merged commit b44f8b7 into master Feb 12, 2025
16 of 19 checks passed
@ardatan ardatan deleted the better-logs branch February 12, 2025 16:28
@coderabbitai coderabbitai bot mentioned this pull request Feb 19, 2025
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