PHPackages                             erik-perri/m2-event-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. erik-perri/m2-event-log

AbandonedArchivedMagento2-module[Logging &amp; Monitoring](/categories/logging)

erik-perri/m2-event-log
=======================

Magento 2 plugin to log events.

2116PHP

Since Oct 29Pushed 5y ago1 watchersCompare

[ Source](https://github.com/erik-perri/m2-event-log)[ Packagist](https://packagist.org/packages/erik-perri/m2-event-log)[ RSS](/packages/erik-perri-m2-event-log/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Magento 2 Event Log
===================

[](#magento-2-event-log)

Magento 2 plugin to log events.

It currently only logs a limited set of the stock Magneto 2 admin actions and is mostly intended for use by developers creating sites that have background tasks which need a visible log in the admin.

[![Preview](.docs/digest-preview.png)](.docs/digest-preview.png)

Logging Example
---------------

[](#logging-example)

```
/** @var \Magento\Framework\Event\ManagerInterface $eventManager */

// Add an info event.  This would be rendered in the "Admin Log" group admin events get logged to.
$eventManager->dispatch('event_log_info', [
    'group' => 'admin',
    'message' => 'Banner {banner} {action}.',
    'context' => [
        'banner' => [
            'text' => $banner->getName(),
            'id' => $banner->getId(),
        ],
        'action' => $banner->isObjectNew() ? 'created' : 'modified',
    ],
]);
```

Placeholders are used in the message for translatability (not yet implemented). When the processor encounters an array as the placeholder value it will use the `text` array value for the replace text. In the above example only the banner name will be displayed in the log unless a custom handler is created to make use of the `id` field.

See [custom-placeholders](.docs/custom-placeholders.md) for a placeholder handler example.

*Your code should not rely on Event Log plugin code to add events or it will fail if the Event Log plugin is removed or disabled. For that reason you should always call the generic Magento 2 event dispatcher to add logs.*

Events
------

[](#events)

### `event_log_info`

[](#event_log_info)

Logs a standard entry.

### `event_log_error`

[](#event_log_error)

Logs an error which will be rendered with a red background.

### `event_log_warning`

[](#event_log_warning)

Logs a warning which will be rendered with a yellow background.

### `event_log_security`

[](#event_log_security)

Logs a security entry which renders the same as warning but will always render all entries, regardless of the hide duplicates setting.

Event Options
-------------

[](#event-options)

### `group`

[](#group)

Type: `String`

The group id to render the message with. If the group is not handled by a custom renderer it will use the standard renderer with the supplied group id converted to title case.

### `message`

[](#message)

Type: `String`

The event log message. Dynamic portions, or HTML, should use {curly-brackets} and the `context` array. The string is passed through an HTML escaper before processing the placeholders.

### `context`

[](#context)

Type: `Array`

The context for the event log message. The context can include non-string values (as long as they can be encoded in json) but any keys referenced in the message string must either be strings or arrays that contain a `text` key. If they do not the message will not be recorded.

### `user-context`

[](#user-context)

Type: `Array|Boolean`

The user context to include with the event log message. If included or set to true the code will attempt to find the current user and attach it to a hidden context field. This will be used to render the user column in the log view.

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1789750?v=4)[Edison eBackpack](/maintainers/ebp)[@ebp](https://github.com/ebp)

### Embed Badge

![Health badge](/badges/erik-perri-m2-event-log/health.svg)

```
[![Health](https://phpackages.com/badges/erik-perri-m2-event-log/health.svg)](https://phpackages.com/packages/erik-perri-m2-event-log)
```

###  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)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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