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.

1.0.1(7mo ago)225MITPHPPHP ^8.0CI passing

Since Oct 10Pushed 7mo 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 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)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)[![Total Downloads](https://camo.githubusercontent.com/204614375c35b647d5376e34a8b78fea9fcdea949e419b969887f77e5d1b7e3f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7770746563686e69782f77702d73696d706c652d6c6f676765722e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wptechnix/wp-simple-logger)[![License](https://camo.githubusercontent.com/2c669332cff8dc65b6b0183516d659be324cb5834be7ba332fdc972e2c32e18c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7770746563686e69782f77702d73696d706c652d6c6f676765722e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wptechnix/wp-simple-logger)[![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.
- 🎨 **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.x
- WordPress 5.7+
- 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`.

```
