PHPackages                             roslov/yii2-compact-file-target - 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. roslov/yii2-compact-file-target

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

roslov/yii2-compact-file-target
===============================

Ignores traces in FileTarget log.

0.1.0(8y ago)0467BSD-3-ClausePHP

Since Oct 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/roslov/yii2-compact-file-target)[ Packagist](https://packagist.org/packages/roslov/yii2-compact-file-target)[ RSS](/packages/roslov-yii2-compact-file-target/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (2)Used By (0)

CompactFileTarget
=================

[](#compactfiletarget)

Ignores traces in FileTarget log.

Even if `traceLevel` is set greater than 0, the trace data will not be written to a log file.

This is needed to have more clean logs on development environment.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist roslov/yii2-compact-file-target "*"

```

or add

```
"roslov/yii2-compact-file-target": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

Let’s imagine you have such configuration:

```
return [
    'bootstrap' => ['log'],
    'components' => [
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['info'],
                    'categories' => ['analytics'],
                    'logVars' => [],
                ],
            ],
        ],
    ],
];
```

After `Yii::info($text, 'analytics');` your log will have such output:

```
2017-10-30 12:11:41 [172.18.0.1][43][-][info][analytics] User 123 updated.
    in /var/www/html/components/analytics/Analytics.php:110
    in /var/www/html/components/analytics/Analytics.php:75
    in /var/www/html/modules/api/v2/behaviors/EventTracker.php:40
2017-10-30 12:11:42 [172.18.0.1][43][-][info][analytics] Notification sent to user 123.
    in /var/www/html/components/analytics/Analytics.php:110
    in /var/www/html/components/analytics/Analytics.php:75
    in /var/www/html/modules/api/v2/behaviors/ActivityTracker.php:85
2017-10-30 12:11:55 [172.18.0.1][43][-][info][analytics] User 456 logged out.
    in /var/www/html/components/analytics/Analytics.php:110
    in /var/www/html/components/analytics/Analytics.php:41
    in /var/www/html/modules/api/v2/behaviors/ActivityTracker.php:57

```

For just logging events you may not need any trace information.

So you can change `class` from `yii\log\FileTarget` to `roslov\log\CompactFileTarget`:

```
return [
    'bootstrap' => ['log'],
    'components' => [
        'log' => [
            'targets' => [
                [
                    'class' => 'roslov\log\CompactFileTarget',
                    'levels' => ['info'],
                    'categories' => ['analytics'],
                    'logVars' => [],
                ],
            ],
        ],
    ],
];
```

In this case the log will look more clean.

```
2017-10-30 12:11:41 [172.18.0.1][43][-][info][analytics] User 123 updated.
2017-10-30 12:11:42 [172.18.0.1][43][-][info][analytics] Notification sent to user 123.
2017-10-30 12:11:55 [172.18.0.1][43][-][info][analytics] User 456 logged out.

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

3116d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/464fc58072b48a348a355eeca35b6fe2e341fd494b4ffb8e30f2007c3a2a6ad5?d=identicon)[tr](/maintainers/tr)

---

Top Contributors

[![roslov](https://avatars.githubusercontent.com/u/6573063?v=4)](https://github.com/roslov "roslov (1 commits)")

---

Tags

logyii2extensionFileTarget

### Embed Badge

![Health badge](/badges/roslov-yii2-compact-file-target/health.svg)

```
[![Health](https://phpackages.com/badges/roslov-yii2-compact-file-target/health.svg)](https://phpackages.com/packages/roslov-yii2-compact-file-target)
```

###  Alternatives

[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3456.3k](/packages/lav45-yii2-activity-logger)[kriss/yii2-log-reader

Yii2 log reader

1340.1k1](/packages/kriss-yii2-log-reader)

PHPackages © 2026

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