PHPackages                             8ctopus/apix-log - 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. 8ctopus/apix-log

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

8ctopus/apix-log
================

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

3.2.0(5mo ago)14413BSD-3-ClausePHPPHP &gt;=8.1CI passing

Since Sep 30Pushed 5mo agoCompare

[ Source](https://github.com/8ctopus/apix-log)[ Packagist](https://packagist.org/packages/8ctopus/apix-log)[ Docs](https://github.com/8ctopus/apix-log)[ RSS](/packages/8ctopus-apix-log/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (39)Used By (3)

APIx Log - a tiny PSR-3 logger
==============================

[](#apix-log---a-tiny-psr-3-logger)

[![packagist](https://camo.githubusercontent.com/eab6dec992e106e7eb29f490335e890ef991449f7ef8c2066ae76472906b45c6/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f617069782d6c6f672f76)](https://packagist.org/packages/8ctopus/apix-log)[![downloads](https://camo.githubusercontent.com/6350a710f56fefc843247b201b8d66127ab02f5c8ea1b5fda42deb2a52a3af21/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f617069782d6c6f672f646f776e6c6f616473)](https://packagist.org/packages/8ctopus/apix-log)[![min php version](https://camo.githubusercontent.com/cc865b07f030bb5ebec8c54c341de1529bb622c33e1444b71ea92e15c38b36f4/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f617069782d6c6f672f726571756972652f706870)](https://packagist.org/packages/8ctopus/apix-log)[![license](https://camo.githubusercontent.com/2d97f67f9e7a328ece14da98a57f387277dbcfcc51bf6b2c6bdfe9c05251b059/68747470733a2f2f706f7365722e707567782e6f72672f3863746f7075732f617069782d6c6f672f6c6963656e7365)](https://packagist.org/packages/8ctopus/apix-log)[![tests](https://github.com/8ctopus/apix-log/actions/workflows/tests.yml/badge.svg)](https://github.com/8ctopus/apix-log/actions/workflows/tests.yml)[![code coverage badge](https://raw.githubusercontent.com/8ctopus/apix-log/image-data/coverage.svg)](https://raw.githubusercontent.com/8ctopus/apix-log/image-data/coverage.svg)[![lines of code](https://raw.githubusercontent.com/8ctopus/apix-log/image-data/lines.svg)](https://raw.githubusercontent.com/8ctopus/apix-log/image-data/lines.svg)

This project is a detached fork of [APIx Log](https://github.com/apix/log) as I wanted to add features and bug fixes not available in the original version.

Minimalist and fast **PSR-3** compliant logger.

- Light, come out-of-the-box bundle with wrappers for:

    - [ErrorLog](src/Logger/ErrorLog.php), [File](src/Logger/File.php), [Mail](src/Logger/Mail.php), [Sapi](src/Logger/Sapi.php) ~ built around the `error_log()` function,
    - [Runtime](src/Logger/Runtime.php) ~ as an Array/ArrayObject wrapper, and [Nil](src/Logger/Nil.php) ~ as Null wrapper,
    - [Stream](src/Logger/Stream.php) ~ logs are sent to sockets, local and remote files, filters and other similar resources (default to standard output bypassing output buffering).
- Extendable, additional logging backends are available:

    - [PHPMailer/apix-log-phpmailer](https://github.com/PHPMailer/apix-log-phpmailer) ~ logs are sent using PHPMailer,
    - [jspalink/apix-log-pushover](https://github.com/jspalink/apix-log-pushover) ~ logs are sent using Pushover,
    - [apix/log-tracker](https://github.com/apix/log-tracker) ~ adds logger/tracker such as Google Analytics, Dashbot, etc...,
- Very fast and even faster when logging is deferred. [See here on how it compares to monolog](https://github.com/apix/log/issues/9)
- Clean API, see the [`LoggerInterface`](src/Logger/LoggerInterface.php) and the [`FormatInterface`](src/FormatInterface.php).
- 100% Unit **tested** and compliant with PSR0, PSR1 and PSR2.

Feel free to comment, send pull requests and patches...

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

[](#installation)

```
  composer require 8ctopus/apix-log

```

Basic usage
-----------

[](#basic-usage)

This simple logger is set to intercept all logs and display them in the console.

```
$console = (new Apix\Log\Logger\Stream('php://stdout'))
   ->setMinLevel('debug')
   ->setFormat(new Apix\Log\Format\StandardColored())
   ->notice('Running out of {items}', 'Running out of {items} - left {left}', [
      'items' => 'beers',
      'left' => 5,
   ]);
```

\[2023-03-20 08:01:25\] NOTICE Running out of beers - left 5

Advanced usage ~ *multi-logs dispatcher*
----------------------------------------

[](#advanced-usage--multi-logs-dispatcher)

Let's create an additional logger with purpose of catching log entries that have a severity level of `warning` or more.
See the [log levels](#log-levels) for the order.

```
$file = (new Apix\Log\Logger\File(__DIR__ . '/app.log'))
   // intercept logs that are >= `warning`
   ->setMinLevel('warning')
   // propagate to other loggers
   ->setCascading(true)
   // postpone writing logs to file
   ->setDeferred(true)
   // flush logs to file once 100 logs are collected
   ->setDeferredTrigger(100);
```

- `setCascading()` set to *true* (default: *true*) so the entries caught here continue downstream past that particular logger.\\
- `setDeferred()` was set to *true* (default: *false*) so processing happens when:
    - `setDeferredTrigger` is reached
    - `flushDeferredLogs` is called
    - `__destruct` (end of script generally)

Now, let's create a main logger object and inject the two previous loggers.

```
$logger = new Apix\Log\Logger([$console, $file]);
```

Finally, let's push some log entries:

```
$exception = new \Exception('Boo!');

// handled by all loggers
$logger->critical('OMG saw {bad-exception}', ['bad-exception' => $exception]);

// push an object (or array) directly
$logger->error($exception);

// handled by console logger
$logger->info('Testing a var {my_var}', ['my_var' => [...]]);
```

Log levels
----------

[](#log-levels)

The eight [RFC 5424](https://tools.ietf.org/html/rfc5424#section-6.2.1) levels of logs are supported, in cascading order:

SeverityDescriptionEmergencySystem level failure (not application level)AlertFailure that requires immediate attentionCriticalSerious failure at the application levelErrorRuntime errors, used to log unhandled exceptionsWarningMay indicate that an error will occur if action is not takenNoticeEvents that are unusual but not error conditionsInfoNormal operational messages (no action required)DebugVerbose info useful to developers for debugging purposes (default)License
-------

[](#license)

APIx Log is licensed under the New BSD license -- see the `LICENSE.txt` for the full license details.

todo
----

[](#todo)

- compare only log entry vs master branch
- fix demo colors in branch only log entry if faster
- should Logger inherit from AbstractLogger?
- add html formatting for emails
- change context logging
- add log line?

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance71

Regular maintenance activity

Popularity18

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 59.2% 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

Every ~127 days

Recently: every ~231 days

Total

33

Last Release

164d ago

Major Versions

1.2.2 → 2.0.02023-02-13

2.1.0 → 3.0.02023-03-20

PHP version history (3 changes)1.0.0PHP &gt;=5.3

1.3.0PHP &gt;=8.0

3.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dafd5f7ef8134a5c9b231686c5da3d6416db09139b45aac0b26952178dffb8a?d=identicon)[8ctopus](/maintainers/8ctopus)

---

Top Contributors

[![8ctopus](https://avatars.githubusercontent.com/u/13252042?v=4)](https://github.com/8ctopus "8ctopus (218 commits)")[![frqnck](https://avatars.githubusercontent.com/u/479874?v=4)](https://github.com/frqnck "frqnck (150 commits)")

---

Tags

psrlogpsr-3loggingtrackingloggerapixtrackerpsr-log

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/8ctopus-apix-log/health.svg)

```
[![Health](https://phpackages.com/badges/8ctopus-apix-log/health.svg)](https://phpackages.com/packages/8ctopus-apix-log)
```

###  Alternatives

[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

511.0M18](/packages/apix-log)[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[analog/analog

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

3451.5M24](/packages/analog-analog)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k6](/packages/inpsyde-wonolog)[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)
