PHPackages                             webarchitect609/log-tools - 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. webarchitect609/log-tools

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

webarchitect609/log-tools
=========================

PSR-3 compatible logger tools

v2.0.1(1y ago)114.2k1BSD-3-ClausePHPPHP ^7.4 || ^8.0CI failing

Since Feb 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/webarchitect609/log-tools)[ Packagist](https://packagist.org/packages/webarchitect609/log-tools)[ RSS](/packages/webarchitect609-log-tools/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (5)Versions (10)Used By (1)

Log Tools
=========

[](#log-tools)

[![Travis Build Status](https://camo.githubusercontent.com/b802ca2f10ed5ace8e6ee6719510c0f63d6c71fb1eeb529b1b46fd8f3fde1c3e/68747470733a2f2f7472617669732d63692e6f72672f7765626172636869746563743630392f6c6f672d746f6f6c732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webarchitect609/log-tools)[![Latest version](https://camo.githubusercontent.com/05d36e84e2d1baa92bb2b61fd72a3bcfb3f8c2cb5cde5502c848891335d138f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f7765626172636869746563743630392f6c6f672d746f6f6c733f736f72743d73656d766572)](https://github.com/webarchitect609/log-tools/releases)[![Downloads](https://camo.githubusercontent.com/7d5309d30cd5ff3152f56bfda9d65cbad282b0c5513473cb355ac28ddda8ec3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765626172636869746563743630392f6c6f672d746f6f6c73)](https://packagist.org/packages/webarchitect609/log-tools)[![PHP version](https://camo.githubusercontent.com/44c6b82765aa763d4afb32cf0a29f75b672761d2e8a454ae7bd2ab281d7a4ed9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7765626172636869746563743630392f6c6f672d746f6f6c73)](https://www.php.net/supported-versions.php)[![License](https://camo.githubusercontent.com/b1e2b3518e65502fe9b43a1992c07013eecc0c0893370a3448ce7f911ac7f39d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7765626172636869746563743630392f6c6f672d746f6f6c73)](LICENSE.md)[![More stuff from me](https://camo.githubusercontent.com/7651d28f6d80c08aa384a801bddbacf7c07ce0d4420108e98b494e7cfbf41e6e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7061636b61676973742d7765626172636869746563743630392d626c756576696f6c6574)](https://packagist.org/packages/webarchitect609/)

PSR-3 compatible logger tools

Features
--------

[](#features)

- Log any exception properly: with the stack trace, with all previous exceptions, etc
- Daily logger: setup directory with log files with 'Y\_m\_d' timestamp as a filename

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

[](#installation)

`composer require webarchitect609/log-tools`

Usage
-----

[](#usage)

### LogExceptionTrait

[](#logexceptiontrait)

Use `\WebArch\LogTools\Traits\LogExceptionTrait` instead of `\Psr\Log\LoggerAwareTrait` in the class you want to be able to log exceptions in more convenient way. Do not forget to implement `\Psr\Log\LoggerAwareInterface`.

When an exception or error occurs feel free to use `logException()` method to log it nice and easy. Exception chaining is enabled by default, but in case you don't need it you can use `setChaining(false)` method.

```
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LogLevel;
use WebArch\LogTools\Traits\LogExceptionTrait;

class FooService implements LoggerAwareInterface
{
    use LogExceptionTrait;

    public function __construct()
    {
        $this->setLogger(
            new Logger(
                'FooLogger',
                [new StreamHandler(sys_get_temp_dir() . '/foo-service.log')]
            )
        );
    }

    public function bar()
    {
        try {

            throw new LogicException('Exception occurs in ' . __METHOD__);

        } catch (Throwable $exception) {

            /**
             * Exception will be logged with it's type, message, code, file, line and stack trace.
             */
            $this->logException($exception, LogLevel::CRITICAL, ['var1' => 'ABC']);
        }
    }

}
```

### MonologLoggerFactory

[](#monologloggerfactory)

Use `\WebArch\LogTools\Factory\MonologLoggerFactory` to simplify creating logs on daily basis.

```
use WebArch\LogTools\Enum\SystemStream;
use WebArch\LogTools\Factory\MonologLoggerFactory;

$debug = false;
$loggerFactory = new MonologLoggerFactory('/tmp/log/www', $debug);
$logger = $loggerFactory->createFileLogger('bar', 'foo/baz.log', SystemStream::STDERR);

/**
 * Creates `/tmp/log/www/foo/baz.log`
 * and outputs `[2019-02-15 12:42:59] bar.INFO: Hello, world! [] []` there
 * and to the STDERR.
 */
$logger->info(
    'Hello, world!'
);
```

Known Issues
------------

[](#known-issues)

None so far.

Licence &amp; Author Information
--------------------------------

[](#licence--author-information)

[BSD-3-Clause](LICENSE.md)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

 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

Every ~245 days

Recently: every ~378 days

Total

9

Last Release

725d ago

Major Versions

v1.2.1 → v2.0.02023-09-27

PHP version history (4 changes)v1.0.0PHP ^7.0

v1.2.0PHP ^7.2

v2.0.0PHP ^7.4

v2.0.1PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f9a6e3ee8c76415a66949c630cd1281bfb6a232a5648b2410574fb6e1e09b65?d=identicon)[webarchitect609](/maintainers/webarchitect609)

---

Top Contributors

[![webarchitect609](https://avatars.githubusercontent.com/u/11293610?v=4)](https://github.com/webarchitect609 "webarchitect609 (9 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/webarchitect609-log-tools/health.svg)

```
[![Health](https://phpackages.com/badges/webarchitect609-log-tools/health.svg)](https://phpackages.com/packages/webarchitect609-log-tools)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[illuminate/log

The Illuminate Log package.

6225.0M601](/packages/illuminate-log)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

84735.1k](/packages/flow-php-flow)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M517](/packages/shopware-core)

PHPackages © 2026

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