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

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

webiik/log
==========

The Log provides simple solution for advanced logging.

1.0(7y ago)0631MITPHPPHP &gt;=7.2

Since Feb 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/webiik/log)[ Packagist](https://packagist.org/packages/webiik/log)[ Docs](https://www.webiik.com)[ RSS](/packages/webiik-log/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

[![](https://camo.githubusercontent.com/a397347ee4fb199934fee6354504f4702b89f5c22f0ce0ba94c5ff691cde545c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667)](https://camo.githubusercontent.com/a397347ee4fb199934fee6354504f4702b89f5c22f0ce0ba94c5ff691cde545c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667)[![](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)](https://camo.githubusercontent.com/20f4b99a958aadb02ff273ac6428c17cf55c6b817657ed64b1c39c7f71955a0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e2e737667)

Log
===

[](#log)

The Log provides simple solution for advanced logging.

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

[](#installation)

```
composer require webiik/log
```

Example
-------

[](#example)

```
$log = new \Webiik\Log\Log();
$log->addLogger(function () {
    return new \Webiik\Log\Logger\FileLogger();
});
$log->info('Hello {name}!', ['name' => 'Dolly!']);
$log->write();
```

Loggers
-------

[](#loggers)

### addLogger

[](#addlogger)

```
addLogger(callable $factory): Logger
```

**addLogger()** creates new **Logger** and injects **$factory** into it. Adds created Logger to **Log** and returns it. To process logs you have to add some Logger(s) to Log. Log comes with 3 optional loggers: ErrorLogger, FileLogger and MailLogger.

```
$log->addLogger(function () {
    return new \Webiik\Log\Logger\ErrorLogger();
});
```

**Write Custom Logger**

You can write your custom logger. Only thing you have to do is to implement `Webiik\Log\Logger\LoggerInterface`.

```
// CustomLogger.php
declare(strict_types=1);

use Webiik\Log\Message;

class CustomLogger implements Webiik\Log\Logger\LoggerInterface
{
    public function write(Message $message): void
    {
        // Process Message...
    }
}
```

Messages
--------

[](#messages)

### add

[](#add)

```
emergency(string $message, array $context = []): Message
alert(string $message, array $context = []): Message
critical(string $message, array $context = []): Message
error(string $message, array $context = []): Message
warning(string $message, array $context = []): Message
notice(string $message, array $context = []): Message
info(string $message, array $context = []): Message
debug(string $message, array $context = []): Message
log(string $level, string $message, array $context = []): Message
```

Adds **Message** to **Log**. Added Messages are not written until the method **write()** is called. The **message** may contain {placeholders} which will be replaced with values from the **context** array. It return **Message**.

```
$log->info('Hello {name}!', ['name' => 'Dolly!']);
```

### write

[](#write)

```
write(): void
```

**write()** removes all added Messages and writes them using the associated loggers.

```
$log->write();
```

### setData

[](#setdata)

```
Message->setData(array $data): Message
```

**setData()** adds extra data to your Message.

```
$log->info('Hello Dolly!')->setData(['greeter' => 'Molly']);
```

Groups
------

[](#groups)

### setGroup

[](#setgroup)

```
Logger->setGroup(string $group): Logger
Message->setGroup(string $group): Message
```

**setGroup()** adds Logger to positive group. Every logger and log message can belong to one or more positive group. When logger belongs to some group(s) then it logs only messages belonging to same group(s).

```
// This logger logs only log messages belonging to 'error' group
$log->addLogger(function () {
    return new \Webiik\Log\Logger\ErrorLogger();
})->setGroup('error');

// Add some log messages
$log->info('Some info.');
$log->warning('Some error.')->setGroup('error');
```

### setNegativeGroup

[](#setnegativegroup)

```
Logger->setNegativeGroup(string $group): Logger
Message->setGroup(string $group): Message
```

**setNegativeGroup()** adds Logger to negative group. Every logger can belong to one or more negative group. When logger belongs to some negative group(s) then it doesn't log messages belonging to same group(s).

```
// This logger doesn't log messages belonging to 'error' group
$log->addLogger(function () {
    return new \Webiik\Log\Logger\FileLogger();
})->setNegativeGroup('error');

// Add some log messages
$log->info('Some info.');
$log->warning('Some error.')->setGroup('error');
```

Levels
------

[](#levels)

### setLevel

[](#setlevel)

```
Logger->setLevel(string $level): Logger
```

**setLevel()** sets Logger to write only Messages with certain [PSR-3](https://www.php-fig.org/psr/psr-3/) log level.

```
// This logger logs messages from all groups but only with log level 'info'
$log->addLogger(function () {
    return new \Webiik\Log\Logger\FileLogger();
})->setLevel('info');
```

Silent mode
-----------

[](#silent-mode)

### setSilent

[](#setsilent)

```
setSilent(bool $silent): void
```

**setSilent()** configures **Log** to skip failed Loggers. In silent mode failed loggers don't stop code execution, instead of it these incidents are logged with other loggers. The default value is **FALSE**.

```
$log = setSilent(true);
```

Resources
---------

[](#resources)

- [Webiik framework](https://github.com/webiik/webiik)
- [Report issue](https://github.com/webiik/components/issues)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

2632d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1226362d003d186b45e7dfa44489c36af37196c6a1b476206700eaf4e9c96a5a?d=identicon)[Jiri Mihal](/maintainers/Jiri%20Mihal)

---

Top Contributors

[![Jiri-Mihal](https://avatars.githubusercontent.com/u/10408123?v=4)](https://github.com/Jiri-Mihal "Jiri-Mihal (203 commits)")

---

Tags

logloggingmonolog

### Embed Badge

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

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

###  Alternatives

[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[logtail/monolog-logtail

Logtail handler for Monolog

233.2M3](/packages/logtail-monolog-logtail)[inpsyde/logzio-monolog

Logz.io integration for Monolog

191.2M1](/packages/inpsyde-logzio-monolog)[mero/yii2-monolog

The Monolog integration for the Yii framework.

42186.1k](/packages/mero-yii2-monolog)[mero/telegram-handler

Monolog handler to send log by Telegram

36113.3k](/packages/mero-telegram-handler)[lefuturiste/monolog-discord-handler

A simple monolog handler for support Discord webhooks

34111.6k4](/packages/lefuturiste-monolog-discord-handler)

PHPackages © 2026

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