Fix: Add missing logging configuration#94
Conversation
Resolves 'Call to undefined method Psr\Log\NullLogger::channel()' error that occurs when Laravel's exception handler tries to log deprecation warnings. The issue happens because Laravel expects a logger with channel() method but receives NullLogger when no logging config exists. This commit adds a proper logging.php configuration with: - Default single file logging channel - Null channel for suppressing deprecations - Daily rotation option - Emergency logging support - Proper storage path handling for global installations
WalkthroughA new logging configuration file ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
✨ 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
🧹 Nitpick comments (1)
config/logging.php (1)
14-25: Hard-coded slash concatenation risks malformed paths
Every channel builds its path with:env('CONDUIT_STORAGE_PATH', storage_path()) . '/logs/…'If
CONDUIT_STORAGE_PATHis set with a trailing slash (e.g./var/lib/conduit/), the resulting path contains a double slash (//logs/…). While most filesystems ignore this, it breaks unit tests on Windows and complicates path comparisons.Tiny utility to normalise:
-$base = env('CONDUIT_STORAGE_PATH', storage_path()); -$path = $base . '/logs/conduit.log'; +$base = rtrim(env('CONDUIT_STORAGE_PATH', storage_path()), DIRECTORY_SEPARATOR); +$path = $base . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . 'conduit.log';You could extract this into a local helper to avoid duplication across channels.
Also applies to: 32-38
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
config/logging.php(1 hunks)
🔇 Additional comments (1)
config/logging.php (1)
27-30: LGTM – correct use of Monolog’sNullHandler
The"null"channel is properly configured and will discard any messages routed to it without raising further exceptions.
| 'deprecations' => [ | ||
| 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), | ||
| 'trace' => env('LOG_DEPRECATIONS_TRACE', false), | ||
| ], |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Defaulting deprecation logging to “null” silently drops important information
LOG_DEPRECATIONS_CHANNEL falls back to "null", which maps to a NullHandler. This means all deprecation warnings are discarded unless the operator explicitly overrides the env var. Given that deprecations often signal upcoming breaking changes, silently dropping them may hide valuable signals during upgrades.
Consider switching the fallback to your dedicated "deprecations" channel and let users opt-out explicitly if they really want to suppress them.
- 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
+ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'deprecations'),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'deprecations' => [ | |
| 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), | |
| 'trace' => env('LOG_DEPRECATIONS_TRACE', false), | |
| ], | |
| 'deprecations' => [ | |
| 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'deprecations'), | |
| 'trace' => env('LOG_DEPRECATIONS_TRACE', false), | |
| ], |
🤖 Prompt for AI Agents
In config/logging.php around lines 6 to 9, the default fallback for
LOG_DEPRECATIONS_CHANNEL is set to "null", which causes deprecation warnings to
be discarded silently. Change the default fallback value from "null" to
"deprecations" so that deprecation logs are sent to a dedicated channel by
default, allowing users to explicitly opt out if they want to suppress these
warnings.
Summary
Problem
When running Conduit commands like
conduit spotify:play, users encounter:This happens because Laravel's exception handler expects a logger with a
channel()method but receivesNullLoggerwhen no logging configuration exists.Solution
Added a proper
logging.phpconfiguration file with:Test Plan
conduit spotify:playor any other commandSummary by CodeRabbit
New Features
Chores