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

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

artex/logger
============

Lightweight, PSR-3-compliant PHP logger for fast and efficient logging.

v1.0.0(1y ago)03Apache-2.0PHPPHP &gt;=8.2

Since Jan 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/artex-agency/artex-logger)[ Packagist](https://packagist.org/packages/artex/logger)[ Docs](https://github.com/artex-agency/artex-logger)[ RSS](/packages/artex-logger/feed)WikiDiscussions main Synced 1mo ago

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

   ![Artex Agency Logo](./docs/media/artex-agency-logo.png)
 **LOGGER**
 FAST PSR-3 LOGGER
===============================================================================================

[](#------------------------------------logger----------------------------fast-psr-3-logger------------)

**Artex Logger** is a lightweight, high-performance PHP logging library that adheres to **PSR-3 standards**, making it highly compatible with existing frameworks. It provides structured logging, supports log rotation, and offers optional asynchronous logging to ensure minimal performance impact.

 [ ![Latest Version](https://camo.githubusercontent.com/e8c0eee49d8279b45bcba3bce561e759b32710b7618355a380a4f48cb5264862/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61727465782f6c6f67676572) ](https://packagist.org/packages/artex/logger) [ ![Total Downloads](https://camo.githubusercontent.com/615ea4c273839979c6bdb8d76eccbee7bc4711ffe396fad04895c952b0286144/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61727465782f6c6f67676572) ](https://packagist.org/packages/artex/logger) [ ![License](https://camo.githubusercontent.com/39a434c39c97856247fc55ebc90e8cc1cb9871558a37bf1bf83cbaca3be89d69/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c7565) ](LICENSE)

Key Features
------------

[](#key-features)

- **Lightweight &amp; High-Performance**: Minimal overhead, designed for speed.
- **PSR-3 Compliant**: Fully compatible with existing logging frameworks.
- **Structured Logging**: Supports JSON and customizable log formats.
- **Log Rotation**: Prevents uncontrolled growth of log files.
- **Asynchronous Logging**: Optional non-blocking log writing.

---

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

[](#installation)

```
composer "require artex/exceptions"
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
use Artex\Exceptions\ArtexRuntimeException;

try {
    throw new ArtexRuntimeException("Something went wrong!", 500);
} catch (ArtexRuntimeException $e) {
    echo $e->getMessage();
}
```

### Adding Context to Exceptions

[](#adding-context-to-exceptions)

```
use Artex\Exceptions\ArtexException;

try {
    throw new ArtexException(
        "Validation failed!",
        422,
        ['field' => 'email', 'error' => 'Invalid format']
    );
} catch (ArtexException $e) {
    // Access additional context
    var_dump($e->getContext());
}
```

### Extending Exceptions

[](#extending-exceptions)

You can easily extend any Artex exception to create project-specific exceptions:

```
namespace MyApp\Exceptions;

use Artex\Exceptions\ArtexRuntimeException;

class CustomException extends ArtexRuntimeException
{
    public function __construct(string $message = "", int $code = 0, array $context = [])
    {
        parent::__construct($message, $code, $context);
    }
}
```

### Logging Exceptions

[](#logging-exceptions)

The library can seamlessly log exceptions if a PSR-3 compatible logger is available:

```
use Artex\Exceptions\ArtexRuntimeException;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

// Set up a PSR-3 logger
$logger = new Logger('example');
$logger->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));

// Register the logger
ArtexRuntimeException::registerLogger($logger);

try {
    throw new ArtexRuntimeException("Critical failure", 500);
} catch (ArtexRuntimeException $e) {
    // Exception is automatically logged
    echo "Exception logged: " . $e->getMessage();
}
```

---

Available Exceptions
--------------------

[](#available-exceptions)

The library ships with the following prebuilt exceptions:

Exception ClassDescription`ArtexException`Base exception class for all custom exceptions.`ArtexRuntimeException`For runtime errors.`ArtexInvalidArgumentException`For invalid arguments passed to functions.`ArtexLogicException`For logical errors in the application.`ArtexUnexpectedValueException`For unexpected values in operations.`ValidationException`For validation-specific errors.`DatabaseException`For database-related errors.`FileException`For file-related errors.---

Advanced Usage
--------------

[](#advanced-usage)

### Extending Exceptions

[](#extending-exceptions-1)

You can easily extend any Artex exception to create project-specific exceptions:

```
namespace MyApp\Exceptions;

use Artex\Exceptions\ArtexRuntimeException;

class CustomException extends ArtexRuntimeException
{
    public function __construct(string $message = "", int $code = 0, array $context = [])
    {
        parent::__construct($message, $code, $context);
    }
}
```

Requirements
------------

[](#requirements)

- PHP 8.0 or higher

---

Contributing
------------

[](#contributing)

We welcome contributions to the Artex Standard Exceptions Library! If you have an idea, feature request, or find a bug, please open an issue or submit a pull request.

LICENSE
-------

[](#license)

This software is distributed under the **Apache 2.0** License, granting you the freedom to use, modify, and distribute the software, provided you adhere to the terms outlined in the license.

See the [LICENSE](./LICENSE) file for details.

FOLLOW US
---------

[](#follow-us)

 [![X/Twitter](./docs/media/social/x.svg)](https://x.com/artexagency "Follow Artex Agency on X/Twitter") [![GitHub](./docs/media/social/github.svg)](https://github.com/artex-agency "Check out Artex Agency on GitHub") [![LinkedIn](./docs/media/social/linkedin.svg)](https://www.linkedin.com/company/artexagency "Connect with Artex Agency on LinkedIn")

  COPYRIGHT © 2025 **ARTEX AGENCY INC.**

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance42

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

477d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e09f360f8998d68822aca7bb668a16c70cd4f250e246e30252d2246d1449ac3b?d=identicon)[jamesgober](/maintainers/jamesgober)

---

Top Contributors

[![jamesgober](https://avatars.githubusercontent.com/u/12473969?v=4)](https://github.com/jamesgober "jamesgober (7 commits)")

---

Tags

custom-loggerloggingphp-loggerpsr-3psr-3phploggingloggerPHP Libraryerror-loggingpsr-loggerphp-loggingArtex-SoftwareArtex-AgencyArtexcustom-loggerefficient-logginglightweight-logger

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/artex-logger/health.svg)

```
[![Health](https://phpackages.com/badges/artex-logger/health.svg)](https://phpackages.com/packages/artex-logger)
```

###  Alternatives

[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
