PHPackages                             iamntz/logger.wp - 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. iamntz/logger.wp

ActiveLibrary

iamntz/logger.wp
================

Logging utility for WordPress

053PHP

Since Nov 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/iamntz/logger.wp)[ Packagist](https://packagist.org/packages/iamntz/logger.wp)[ RSS](/packages/iamntz-loggerwp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

What is this?
-------------

[](#what-is-this)

A small utility that will allow you to easily log various errors per user basis. Basically this is a wrapper for [katzgrau/klogger](https://github.com/katzgrau/KLogger).

Installing
----------

[](#installing)

```
composer require iamntz/logger.wp

```

#### Customizing paths and names

[](#customizing-paths-and-names)

By default, logs will be saved in `wp-content/uploads/loggerwp/` folder. You can change this by using the `iamntz/loggerwp/log-path` hook. E.g.:

```
add_filter('iamntz/loggerwp/log-path', function(){ return 'my-awesome-path'; });

```

You can also change the log file name. By default is *per user* and it follows the pattern: `ID-week-year-AUTH_SALT` (`AUTH_SALT` being hashed).

Using
-----

[](#using)

You have several error levels, following [PSR3 specs](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md):

```
$logs = new LoggerWP;

$logs->emergency('Message', [], $enabled);
$logs->alert('Message', [], $enabled);
$logs->critical('Message', [], $enabled);
$logs->error('Message', [], $enabled);
$logs->warning('Message', [], $enabled);
$logs->notice('Message', [], $enabled);
$logs->info('Message', [], $enabled);
$logs->debug('Message', [], $enabled);

```

Each method receives the same arguments: a text message, an array and a boolean. Last two are optional.

Reading logs
------------

[](#reading-logs)

You can also read logs:

```
$logs = new LoggerWP;

$logs->getLogs(50, 'warning'); // gets last 50 warnings
$logs->getLogs(5, 'debug'); // gets last 50 debug messages

```

#### Hints

[](#hints)

You could define various levels of verbosity:

```
// in your plugin/theme file

if (!defined('MY_PLUGIN_VERBOSE_LEVEL')) {
  define('MY_PLUGIN_VERBOSE_LEVEL', WP_DEBUG);
}

define('MY_PLUGIN_VERBOSE_LEVEL__VVV', MY_PLUGIN_VERBOSE_LEVEL === 'vvv' );
define('MY_PLUGIN_VERBOSE_LEVEL__VV', MY_PLUGIN_VERBOSE_LEVEL__VVV || MY_PLUGIN_VERBOSE_LEVEL === 'vv' );
define('MY_PLUGIN_VERBOSE_LEVEL__V', MY_PLUGIN_VERBOSE_LEVEL__VV || MY_PLUGIN_VERBOSE_LEVEL === 'v' );

```

Then you could define `MY_PLUGIN_VERBOSE_LEVEL` constant in your `wp-config.php` file. And finally, you can use it:

```
$logs->debug('Message', [], MY_PLUGIN_VERBOSE_LEVEL__VVV);
$logs->alert('Message', [], MY_PLUGIN_VERBOSE_LEVEL);
$logs->emergency('Fatal error!');

```

Like it?
--------

[](#like-it)

You can get [hosting](https://m.do.co/c/c95a44d0e992), [donate](https://www.paypal.me/iamntz) or buy me a [gift](http://iamntz.com/wishlist).

License
-------

[](#license)

MIT.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e9ccfed015f7f50e1be8516c662566e7defbcb483b2f0505199912ed3302032?d=identicon)[iamntz](/maintainers/iamntz)

---

Top Contributors

[![iamntz](https://avatars.githubusercontent.com/u/132062?v=4)](https://github.com/iamntz "iamntz (7 commits)")

### Embed Badge

![Health badge](/badges/iamntz-loggerwp/health.svg)

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

PHPackages © 2026

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