PHPackages                             mellivora/logger-factory - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. mellivora/logger-factory

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

mellivora/logger-factory
========================

A modern logger factory library based on Monolog for PHP 8.3+, with seamless Laravel integration

v2.0.0(10mo ago)104803[3 PRs](https://github.com/zhouyl/mellivora-logger-factory/pulls)MITPHPPHP &gt;=8.3.0CI passing

Since Sep 17Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/zhouyl/mellivora-logger-factory)[ Packagist](https://packagist.org/packages/mellivora/logger-factory)[ Docs](https://github.com/zhouyl/mellivora-logger-factory)[ RSS](/packages/mellivora-logger-factory/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (26)Used By (0)

Mellivora Logger Factory
========================

[](#mellivora-logger-factory)

[![Version](https://camo.githubusercontent.com/dd1b51eac051b316a3173585bc64d36e19fa2d4e90a4581734cc292c175130f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e302e302d626c75652e737667)](https://github.com/zhouyl/mellivora-logger-factory/releases)[![CI](https://github.com/zhouyl/mellivora-logger-factory/actions/workflows/ci.yml/badge.svg)](https://github.com/zhouyl/mellivora-logger-factory/actions/workflows/ci.yml)[![Coverage](https://github.com/zhouyl/mellivora-logger-factory/actions/workflows/coverage.yml/badge.svg)](https://github.com/zhouyl/mellivora-logger-factory/actions/workflows/coverage.yml)[![Quality](https://github.com/zhouyl/mellivora-logger-factory/actions/workflows/quality.yml/badge.svg)](https://github.com/zhouyl/mellivora-logger-factory/actions/workflows/quality.yml)[![PHP Version](https://camo.githubusercontent.com/5c8ce4571ddf4b6b8ca847e0c4c079de98fc6460eb7eae9c81ca63319c21f546/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e332d626c75652e737667)](https://php.net/)[![Monolog Version](https://camo.githubusercontent.com/7820de7c634a8e3fd1ca6c1d9ad17c4011fdc85f9b2f8690423ffde3f30df720/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6f6e6f6c6f672d332e782d677265656e2e737667)](https://github.com/Seldaek/monolog)[![Laravel Support](https://camo.githubusercontent.com/42cfba12244453656c2836687fcf763e35dc2ae3487b327e5831fc942c723cfb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31302e7825323025374325323031312e782d7265642e737667)](https://laravel.com/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

A modern logging factory library based on [Monolog](https://seldaek.github.io/monolog/), designed for PHP 8.3+, providing powerful logging management capabilities and seamless Laravel framework integration.

**🧪 High Quality Assurance**: Features **88.82%** test coverage with 144 test methods and 367 assertions, ensuring code quality and stability.

> **🎉 Stable Release**: Current version is **2.0.0**, a stable release ready for production use. This version has been thoroughly tested with 87.28% test coverage and enterprise-grade quality assurance.

> **🤖 AI-Driven Development**: This project's refactoring and testing improvements were completed entirely by [Augment](https://www.augmentcode.com/) intelligent coding AI tool, demonstrating AI's powerful capabilities in modern software development.

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [✨ Key Features](#-key-features)
- [📋 System Requirements](#-system-requirements)
- [🚀 Installation](#-installation)
- [📖 Usage](#-usage)
- [🔧 Laravel Integration](#-laravel-integration)
- [🧪 Testing](#-testing)
- [⚠️ Version Notes](#%EF%B8%8F-version-notes)
- [🤝 Contributing](#-contributing)
- [📞 Support](#-support)
- [📄 License](#-license)
- [🙏 Acknowledgments](#-acknowledgments)

✨ Key Features
--------------

[](#-key-features)

### 🚀 Modern PHP 8.3+ Features

[](#-modern-php-83-features)

- **Strict Type Declarations**: Comprehensive use of `declare(strict_types=1)` and typed properties
- **Constructor Property Promotion**: Concise constructor syntax
- **Readonly Properties**: Using `readonly` keyword to protect important properties
- **Match Expressions**: Replacing traditional switch statements with safer pattern matching
- **Union Types**: Support for flexible type definitions like `int|Level|string`

### 🎯 Core Functionality

[](#-core-functionality)

- **Multi-Channel Log Management**: Support for separating log channels by functional modules
- **Rich Processors**: Built-in performance profiling, memory monitoring, web request processors
- **Flexible Formatting**: Support for JSON, HTML, custom formats and multiple output formats
- **Smart Rotation**: Automatic log file rotation by date and file size
- **Exception Enhancement**: Automatic extraction and structured recording of detailed exception information
- **Filter Support**: Custom log filtering logic

### 🔧 Laravel Integration

[](#-laravel-integration)

- **Zero Configuration**: Automatic service discovery and registration
- **Facade Support**: `MLog` facade for convenient access
- **Helper Functions**: `mlog()`, `mlog_with()`, `mlog_debug()` etc.
- **Middleware Support**: Built-in request logging middleware
- **Artisan Commands**: Testing and management commands
- **Configuration Publishing**: Customizable configuration files

### 📊 Advanced Features

[](#-advanced-features)

- **Performance Monitoring**: Built-in execution time and memory usage tracking
- **Context Enhancement**: Automatic addition of request ID, user information, etc.
- **Error Handling**: Graceful handling of logging failures
- **Caching Support**: Intelligent caching for improved performance
- **Security Features**: Sensitive data filtering and sanitization

📋 System Requirements
---------------------

[](#-system-requirements)

- **PHP**: 8.3 or higher
- **Monolog**: ^3.0
- **PSR-Log**: ^3.0
- **Laravel**: ^10.0 | ^11.0 (optional, for Laravel integration)

Installation
------------

[](#installation)

Install the stable version using Composer:

```
# Install stable version
composer require mellivora/logger-factory:^2.0.0

# Or specify exact version
composer require mellivora/logger-factory:2.0.0
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
