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

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

wptechnix/wp-simple-logger
==========================

A flexible, performant PSR-3 compliant logging library for WordPress. Features handlers for files, database (with admin UI), email, and is highly extensible.

v2.0.0(1mo ago)00MITPHPPHP ^8.0CI passing

Since Jul 12Pushed 1mo agoCompare

[ Source](https://github.com/WPTechnix/wp-simple-logger)[ Packagist](https://packagist.org/packages/wptechnix/wp-simple-logger)[ RSS](/packages/wptechnix-wp-simple-logger/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (22)Versions (4)Used By (0)

WP Simple Logger
================

[](#wp-simple-logger)

[![Latest Version](https://camo.githubusercontent.com/33dd1eecc3a5a22e5ed25d80f887fa5e10dc6c56f205ac797ab9f39715c8ac5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7770746563686e69782f77702d73696d706c652d6c6f676765722e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wptechnix/wp-simple-logger)[![License](https://camo.githubusercontent.com/31e62e0eff03ce9ddfdf69d8476340d4f541990bfb152cb02a0f342965252997/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](./LICENSE)[![PHP Version Require](https://camo.githubusercontent.com/33a0b50d6b6bdb9c1e85d4a586b5b7b2b86c50cd9efc6ea3cb995cf6e3cac678/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7770746563686e69782f77702d73696d706c652d6c6f676765722f7068702e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wptechnix/wp-simple-logger)

A powerful, flexible, and developer-friendly PSR-3 compliant logging library for WordPress. It provides a robust framework for capturing, managing, and storing application events, errors, and debugging information in a structured and efficient way.

Designed to be both simple for basic use and highly extensible for complex applications, this library is the ideal choice for plugin and theme developers who need a reliable logging solution that goes beyond `error_log()`.

Key Features
------------

[](#key-features)

- ✅ **PSR-3 Compliant**: A standard, interoperable interface (`$logger->info(...)`, `$logger->error(...)`).
- 🗂️ **Channel-Based Logging**: Organize logs into different "channels" (e.g., 'payments', 'api', 'debug') for easy filtering.
- 🚀 **Multiple Handlers**: Ship logs to various destinations simultaneously.
    - **File Handler**: Writes logs to a server file.
    - **Database Handler**: Stores logs in a custom database table.
    - **Email Handler**: Sends high-priority logs via email.
    - **Slack Handler**: Posts color-coded alerts to a Slack channel.
    - **Webhook Handler**: Ships structured JSON logs to any HTTP endpoint.
    - **Null Handler**: Discards logs, handy for tests or disabling output.
- 🎨 **Customizable Formatters**: Control the output format with Line, JSON, or HTML formatters.
- 🖥️ **Built-in Log Viewer**: A beautiful, filterable, and searchable admin interface for logs stored in the database.
- ⚡️ **Performance-Oriented**: Logs are buffered and written in batches during the `shutdown` hook to minimize impact.
- 🧩 **Extensible Architecture**: Easily create your own custom handlers and formatters.

### Powerful Admin Interface

[](#powerful-admin-interface)

The Database Handler includes a full-featured Log Viewer right in your WordPress dashboard.

[![Log Viewer Interface](./docs/table-screenshot.png)](./docs/table-screenshot.png)

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

[](#installation)

**Requirements:**

- PHP 8.0+
- WordPress 5.0+
- Composer

Install the library using Composer:

```
composer require wptechnix/wp-simple-logger
```

Then, ensure you include Composer's autoloader in your plugin or theme:

```
require_once __DIR__ . '/vendor/autoload.php';
```

Quick Start
-----------

[](#quick-start)

The easiest way to get started is to log messages to a file. Place this code in your main plugin file or your theme's `functions.php`.

```
