Skip to content

fix(component): fix warning for invalid log levels#36

Open
ic4l4s9c wants to merge 1 commit into
get-convex:mainfrom
ic4l4s9c:fix/invalid-log-levels-warning
Open

fix(component): fix warning for invalid log levels#36
ic4l4s9c wants to merge 1 commit into
get-convex:mainfrom
ic4l4s9c:fix/invalid-log-levels-warning

Conversation

@ic4l4s9c

@ic4l4s9c ic4l4s9c commented Apr 6, 2026

Copy link
Copy Markdown

Fix log level validation logic and deduplicate LOG_LEVELS constant

Changes

  • Fixed log level validation to only apply the env var when it's actually valid - previously it would warn about invalid values but still use them anyway
  • Extracted LOG_LEVELS array as an exported constant to avoid duplication between client and logging module
  • Warning message now correctly references the actual default value instead of hardcoded string

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Summary by CodeRabbit

  • Refactor
    • Improved logging level configuration consistency by centralizing log level definitions for better maintainability across the system.

@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7bed03a6-e0a9-4b28-9871-1476e7cf87ad

📥 Commits

Reviewing files that changed from the base of the PR and between 51f2f8b and 906794a.

📒 Files selected for processing (2)
  • src/client/index.ts
  • src/component/lib/logging.ts

📝 Walkthrough

Walkthrough

A refactoring extracts the log levels array from multiple locations into a centralized exported constant LOG_LEVELS in the logging module, then updates the logging-level validation logic across the codebase to use this shared constant instead of inline duplicates.

Changes

Cohort / File(s) Summary
Logging Constants
src/component/lib/logging.ts
Extracted log levels array ["DEBUG", "INFO", "WARN", "ERROR"] into exported constant LOG_LEVELS and updated createLogger() to use it for validation.
Client Logging Configuration
src/client/index.ts
Updated GeospatialIndex constructor to import and use the centralized LOG_LEVELS constant instead of an inline hard-coded list for environment variable validation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A constant hops through our code today,
No more duplication in the way!
Log levels dance in one happy place,
Where all our modules share the grace.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing log level validation and warning behavior in the component's logging module.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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