Skip to content

Commit

Permalink
Merge branch 'feature/initial-version'
Browse files Browse the repository at this point in the history
  • Loading branch information
markheydon committed Oct 12, 2018
2 parents 97dbc26 + 10f5294 commit 1641c52
Show file tree
Hide file tree
Showing 10 changed files with 3,526 additions and 6 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
/coverage/
*.cache
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php

sudo: false

php:
- 7.1
- 7.2

cache:
directories:
- $HOME/.composer/cache

before_script:
- composer install --prefer-source --no-interaction --dev

script: composer tests
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
# monolog-wp-cli
Extension for Monolog to support outputting to WP-CLI when running wp command lines.
# Monolog WP-CLI Handler

[![Build Status](https://img.shields.io/travis/com/mhcg/monolog-wp-cli.svg)](https://travis-ci.com/mhcg/monolog-wp-cli)
[![Latest Stable Version](https://img.shields.io/packagist/v/mhcg/monolog-wp-cli.svg)](https://packagist.org/packages/mhcg/monolog-wp-cli)

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

## Installation
Install the latest version with Composer.

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

## Basic Usage

```php
<?php

use Monolog\Logger;
use MHCG\Monolog\Handler;

// create a log channel
$log = new Logger( 'name' );
$log->pushHandler( new WPCLIHandler( Logger::WARNING ) );

// output to WP-CLI
$log->warning( 'This is a warning' );
$log->error( 'An error has occurred' );
$log->critical( 'This will report error and exit out' );
```

## Author
Mark Heydon <[contact@mhcg.co.uk](contact@mhcg.co.uk)>

## License
Monolog is licensed under the MIT License and therefore so is this handler - see the LICENSE file for details.


45 changes: 45 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "mhcg/monolog-wp-cli",
"description": "Monolog handler to support WP-CLI calls",
"keywords": [
"log",
"logging",
"psr-3",
"wp-cli"
],
"license": "MIT",
"authors": [
{
"name": "Mark Heydon",
"email": "contact@mhcg.co.uk",
"role": "Developer"
}
],
"type": "library",
"require": {
"php": ">=7.1",
"monolog/monolog": "~1"
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"jakub-onderka/php-parallel-lint": "^0.9",
"squizlabs/php_codesniffer": "^3.3",
"friendsofphp/php-cs-fixer": "^2.13"
},
"autoload": {
"psr-4": {
"MHCG\\Monolog\\": "src/Monolog"
}
},
"autoload-dev": {
"psr-4": {
"MHCGDev\\Monolog\\": "tests/Monolog"
}
},
"scripts": {
"tests": "composer fixes && composer sniffs && composer lints && phpunit --coverage-clover coverage/clover.xml",
"sniffs": "phpcs --standard=PSR2 src/ && phpcs --standard=PSR2 tests/",
"fixes": "php-cs-fixer fix src/ && php-cs-fixer fix tests/",
"lints": "parallel-lint ./src --blame --exclude vendor && parallel-lint ./tests --blame --exclude vendor"
}
}
Loading

0 comments on commit 1641c52

Please sign in to comment.