PHPackages                             mvf-tech/system\_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. mvf-tech/system\_logger

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

mvf-tech/system\_logger
=======================

A package used to perform DataDog and system logs

3.1.1(3y ago)210.0k↓50%[1 PRs](https://github.com/mvf-tech/system-logger/pulls)MITPHPPHP ^7.1|^8.0CI failing

Since Sep 27Pushed 3y agoCompare

[ Source](https://github.com/mvf-tech/system-logger)[ Packagist](https://packagist.org/packages/mvf-tech/system_logger)[ RSS](/packages/mvf-tech-system-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (12)Used By (0)

SYSTEM LOGGER
=============

[](#system-logger)

> A package used to perform DataDog and system logs

### Releases

[](#releases)

- 3.0.0 - [Patch Notes](./releases/3.0.0.md)
- 2.1.0 - [Patch Notes](./releases/2.1.0.md)
- 2.0.2 - [Patch Notes](./releases/2.0.2.md)
- 2.0.1 - [Patch Notes](./releases/2.0.1.md)
- 2.0.0 - [Patch Notes](./releases/2.0.0.md)
- 1.0.0

### Installation and Setup

[](#installation-and-setup)

1. Run `composer require mvf-tech/system_logger` to install the package
2. You will also have to set `DATADOG_PROJECT_NAME` and `DATADOG_SERVICE_NAME` ENV variables

### Basic Use

[](#basic-use)

```
use MVF\SystemLogger\Reporters\Remotes\DataDog\DataDog;
use MVF\SystemLogger\Reporters\Host\CommandLine;
use MVF\SystemLogger\SystemLogger;

$logger = new SystemLogger();
$logger->info(
    ["some_kind_of_tag", "key" => "another_tag"],
    "message",
    new CommandLine(),
    DataDog::histogram("metric_name_suffix", 2)
);
```

There are two type of reporters available, `host` reporters, `CommandLine` in the above example, and `remote`reporters, `DataDog.histogram(...)` in the above example. `host` reporters are used to log messages, these reporters do not receive the list of tags and therefore are not able to do anything with it. `remote` reporters are used to make more complex logs, they receive only the list of tags, the message is appended to the tag list as `"message" => "the message"`. You can create your own reporters by implementing `HostLogInterface` or `RemoteLogInterface` more about this later.

### SystemLogger

[](#systemlogger)

include:

- `use MVF\SystemLogger\SystemLogger;`

methods:

- `->info(array $tags, string $message, (HostLogInterface|RemoteLogInterface) ...$loggers)`
- `->warning(array $tags, string $message, (HostLogInterface|RemoteLogInterface) ...$loggers)`
- `->error(array $tags, string $message, (HostLogInterface|RemoteLogInterface) ...$loggers)`

The `system logger` is used as a central storage unit, it does `not` perform any logging by itself instead it is responsible for message processing and reduction of code duplication since the same tags and message are passed to all of the provided reporters.

#### Default Tags

[](#default-tags)

The following are the default tags that will be appended to the provided list.

- `info`, `warning` or `error` one of these will be appended based on which system logger function was called.

#### Message Placeholders

[](#message-placeholders)

There are two kinds of message placeholders `tag` and `reporter`.

```
$logger->info(
    [
        "name" => "Bob"                     // tag key name
    ],
    "There are :1 messages from :name",
    new CommandLine(),                      // reporter index 0
    DataDog::histogram("messages", 2),      // reporter index 1
    ...                                     // reporter index ...
);
```

`tag` placeholder is identified with a `:` followed by the `key` of one of your tags, in the above example `:name` is a valid `tag`. `reporter` placeholder is identified by `:` followed by the `index` of one of your reporters so in the above example `:1` would be replaced with the value of `DataDog.histogram("messages", 2)` which in this case would be `2`.

\#####Notes

- `:0` would not be replaced since `CommandLine` implements `HostLogInterface` and host reporters do not have any return value.

### Default Reporters

[](#default-reporters)

These are responsible for the actual logging of information. At the moment there are two default reporters built in `CommandLine` and `DataDog`.

#### CommandLine

[](#commandline)

This is a basic reporter that will simply echo messages to the standard out.

#### DataDog

[](#datadog)

include:

- `use MVF\SystemLogger\Reporters\Remotes\DataDog\DataDog;`

methods:

- `::gauge(string $suffix, int $value): Gauge`
- `::histogram(string $suffix, int $value, float $sample_rate = 1.0): Histogram`
- `::time(string $suffix, (float|callable) $time): Time`
- `::unique(string $suffix, int $value): Unique`

`suffix` is the last part of your DataDog metric name. All DataDog metric names will consist of `DATADOG_PROJECT_NAME.suffix` where `DATADOG_PROJECT_NAME` is loaded from ENV, if these variables are not set then the beginning of your metric will default to `notset.suffix`. In Addition all DataDog logs will be sent with additional tag `DATADOG_SERVICE_NAME` which is also loaded from ENV, if this variable is not set then it will default to value `notset`.

### Custom Reporters

[](#custom-reporters)

You can create your own `host` or `remote` reporters by creating a class and implementing `HostLogInterface` or `RemoteLogInterface` respectively.

#### HostLogInterface

[](#hostloginterface)

include:

- `use MVF\SystemLogger\HostLogInterface;`

methods:

- `->info(string $message): \Exception|null` : should make a log with info severity.
- `->warning(string $message): \Exception|null` : should make a log with warning severity.
- `->error(string $message): \Exception|null` : should make a log with error severity.

Each method receives the `message` with replaced `placeholders`. If an exception is thrown in the reporter then it should be caught and returned, the system logger will re-throw it once all other logs are performed. An example of laravel standard out reporter can be found [here](https://bitbucket.org/mvfglobal/mercury/src/2e033fa6d894045b5ecd1d56cb1c46993e8b7cb4/app/Services/LaravelLogger.php?at=master&fileviewer=file-view-default).

#### RemoteLogInterface

[](#remoteloginterface)

include:

- `use MVF\SystemLogger\RemoteLogInterface;`

methods:

- `->send(string[] $tags): \Exception|null` : `tags` array will always have at least these values `[ "", "message" => "",  ]`. If an exception is thrown in the reporter then it should be caught and returned, the system logger will re-throw it once all other logs are performed.
- `->getValue(): string|int` : if your remote reporter has a value that may be returned then this function should return it, otherwise return string `NOT_IMPLEMENTED`.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity73

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 ~167 days

Recently: every ~301 days

Total

9

Last Release

1452d ago

Major Versions

1.0.0 → 2.0.02018-10-04

2.1.0 → 3.0.02019-10-14

PHP version history (2 changes)1.0.0PHP &gt;=7.1.0

3.1.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43647560?v=4)[MVF](/maintainers/mvf-tech)[@mvf-tech](https://github.com/mvf-tech)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mvf-tech-system-logger/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[ekino/newrelic-bundle

Integrate New Relic into Symfony2

28111.2M8](/packages/ekino-newrelic-bundle)

PHPackages © 2026

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