PHPackages                             ody/logger - 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. ody/logger

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

ody/logger
==========

logging integration for ODY Framework

0.2.0(1y ago)0332MITPHPPHP &gt;=8.3

Since Mar 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ody-dev/Logger)[ Packagist](https://packagist.org/packages/ody/logger)[ RSS](/packages/ody-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (5)Used By (2)

Logging
-------

[](#logging)

Logging is configured in `config/logging.php` and provides various channels for logging:

```
// Using the logger
$logger->info('User logged in', ['id' => $userId]);
$logger->error('Failed to process payment', ['order_id' => $orderId]);

// Using the logger helper function
logger()->info('Processing request');
```

Custom Loggers in ODY Framework
===============================

[](#custom-loggers-in-ody-framework)

Creating Custom Loggers
-----------------------

[](#creating-custom-loggers)

### Basic Requirements

[](#basic-requirements)

All custom loggers must:

1. Extend `Ody\Logger\AbstractLogger`
2. Implement a static `create(array $config)` method
3. Override the `write(string $level, string $message, array $context = [])` method

### Example: Creating a Custom Logger

[](#example-creating-a-custom-logger)

Here's a simple example of a custom logger that logs to Redis:

```
