PHPackages                             mhcg/monolog-wp-cli - 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. mhcg/monolog-wp-cli

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

mhcg/monolog-wp-cli
===================

Extension for Monolog to support outputting to WP-CLI (The WordPress command line interface) when running wp command lines.

v2.0.0(3y ago)10105.9k—5.1%3[5 issues](https://github.com/mhcg/monolog-wp-cli/issues)1MITPHPPHP ^7.3 | ^7.4 | ^8.0

Since Oct 12Pushed 2y ago2 watchersCompare

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

READMEChangelog (5)Dependencies (3)Versions (8)Used By (1)

Monolog WP-CLI Handler
======================

[](#monolog-wp-cli-handler)

[![Latest Stable Version](https://camo.githubusercontent.com/52f2fb46ba9cf754e68d90612ce903f78d45b528225a4e279f57a01e75eddbd3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6863672f6d6f6e6f6c6f672d77702d636c692e737667)](https://packagist.org/packages/mhcg/monolog-wp-cli)[![Code Climate](https://camo.githubusercontent.com/052fb26b694cac0d37098d4da11b2812545639fa0dca6aebd192e1f1f4d6b91d/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f6d6863672f6d6f6e6f6c6f672d77702d636c692e737667)](https://codeclimate.com/github/mhcg/monolog-wp-cli)[![Code Climate coverage](https://camo.githubusercontent.com/7f1fbe95854255eec4304049ba2790c07e9bed105a56dc2cce6f9e4bec6d2955/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f636f7665726167652f6d6863672f6d6f6e6f6c6f672d77702d636c69)](https://codeclimate.com/github/mhcg/monolog-wp-cli)

Handler for [Monolog](https://github.com/Seldaek/monolog) to support outputting to WP-CLI when running wp command lines.

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

[](#installation)

Install the latest version with Composer.

```
$ composer require mhcg/monolog-wp-cli
```

Basic Usage
-----------

[](#basic-usage)

### Example 1 - Basic Concept

[](#example-1---basic-concept)

Monolog WP-CLI Handler works the same as any other handler, so create a new WPCLIHandler object and push it to your Logger object. Of course, this will only work as part of a WP-CLI command within a WordPress theme or plugin. See Example 2 for a real-world example.

```
