Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Log Laravel Package

illuminate/log

Illuminate Log provides Laravel’s logging layer, built on Monolog. It lets you write messages to configurable channels and stacks, including single files, daily rotation, syslog, errorlog, and external services, with context data, processors, and runtime channel selection.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package via Composer (composer require illuminate/log) in a standalone PHP project or when extending Laravel (it's included by default). For new projects, integrate it with a PSR-3 compatible logger (like Monolog) to get started quickly. The simplest use case is logging a message:

use Illuminate\Log\Logger;

$logger = new Logger('app', [new Monolog\Handler\StreamHandler(storage_path('logs/app.log'))]);
$logger->info('Application started');

Check the Laravel logging documentation since this package follows the same interface and patterns used in Laravel apps.

Implementation Patterns

  • Singleton logger instance: Hoist the Logger instance in a service container or as a static service for DI-free scenarios.
  • Channel-based configuration: Use different handlers per channel (e.g., single, daily, slack) by passing Monolog handlers grouped per channel to the Logger constructor.
  • Tap handlers: Implement Tap interfaces to mutate log records before dispatch (e.g., adding metadata, scrubbing secrets).
  • Context enrichment: Pass contextual data via the second argument:
    $logger->info('User logged in', ['user_id' => $user->id]);
    
  • Custom levels: Although Logger extends Monolog, you can extend Logger and override log() to enforce custom level rules.

Gotchas and Tips

  • No out-of-the-box config loader: Unlike Laravel, this subtree split does not include LogManager, so you must manually wire handlers (no config/logging.php equivalent).
  • PHP 8.3+ required: Ensure your environment meets the strict requirement—common pitfall when upgrading to Laravel 11 or standalone use.
  • Monolog version lock-in: Though it supports PSR-3, some advanced features (e.g., processors, formatters) depend on Monolog 3.x. Avoid mixing Monolog 2.x handlers inadvertently.
  • Missing Laravel conveniences: Functions like Log::channel() or Log::stack() won’t be available without the full framework. Implement them yourself or use Laravel’s Log facade in actual Laravel projects instead.
  • Testing tip: Mock or replace handlers in tests using Symfony\Component\HttpFoundation\StreamedResponse or in-memory handlers to assert log output.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport