-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/.idea | ||
/vendor | ||
/composer.lock | ||
/tests/*.log | ||
/tests/tmp | ||
/tests/.coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
language: php | ||
php: | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini | ||
|
||
install: | ||
- composer install --no-progress --prefer-dist | ||
|
||
script: | ||
- composer run-script tester | ||
|
||
jobs: | ||
include: | ||
- stage: Test Coverage | ||
php: 7.1 | ||
script: | ||
- composer run-script coverage | ||
after_script: | ||
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar | ||
- php coveralls.phar -c tests/.coveralls.yml | ||
|
||
allow_failures: | ||
- stage: Test Coverage | ||
|
||
after_failure: | ||
- for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
# logger | ||
# GrapeFluid/Logger | ||
|
||
[![PHP from Packagist](https://img.shields.io/packagist/php-v/grape-fluid/logger.svg?style=flat-square)](https://packagist.org/packages/grape-fluid/logger) | ||
[![Build Status](https://img.shields.io/travis/grape-fluid/logger.svg?style=flat-square)](https://travis-ci.org/grape-fluid/logger) | ||
[![Code coverage](https://img.shields.io/coveralls/grape-fluid/logger.svg?style=flat-square)](https://coveralls.io/r/grape-fluid/logger) | ||
[![Licence](https://img.shields.io/packagist/l/grape-fluid/logger.svg?style=flat-square)](https://packagist.org/packages/grape-fluid/logger) | ||
[![Downloads this Month](https://img.shields.io/packagist/dm/grape-fluid/logger.svg?style=flat-square)](https://packagist.org/packages/grape-fluid/logger) | ||
[![Downloads total](https://img.shields.io/packagist/dt/grape-fluid/logger.svg?style=flat-square)](https://packagist.org/packages/grape-fluid/logger) | ||
[![Latest stable](https://img.shields.io/packagist/v/grape-fluid/logger.svg?style=flat-square)](https://packagist.org/packages/grape-fluid/logger) | ||
|
||
|
||
## Install | ||
|
||
``` | ||
composer require grape-fluid/logger | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "grape-fluid/logger", | ||
"keywords": ["grape-fluid", "fluid-cms", "log", "monolog"], | ||
"type": "library", | ||
"license": "BSD-3-Clause", | ||
"homepage": "https://github.com/grape-fluid/logger", | ||
"authors": [ | ||
{ | ||
"name": "GRAPE SC, a.s.", | ||
"email": "developers@grapesc.cz", | ||
"homepage": "https://developers.grapesc.cz" | ||
} | ||
], | ||
"require": { | ||
"php": ">= 5.6", | ||
"monolog/monolog": "^1.23.0" | ||
}, | ||
"require-dev": { | ||
"nette/tester": "^2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Grapesc\\GrapeFluid\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\Fixtures\\": "tests/fixtures" | ||
} | ||
}, | ||
"scripts": { | ||
"tester": [ | ||
"tester -s -C tests/cases" | ||
], | ||
"coverage": [ | ||
"tester -s -C -d zend_extension=xdebug.so --coverage ./tests/.coverage.xml --coverage-src ./src tests/cases" | ||
] | ||
}, | ||
"prefer-stable": true, | ||
"minimum-stability": "dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Grapesc\GrapeFluid; | ||
|
||
/** | ||
* @author Mira Jakes <jakes@grapesc.cz> | ||
*/ | ||
class Logger extends \Monolog\Logger | ||
{ | ||
|
||
/** | ||
* @param callable[] $processors | ||
*/ | ||
public function setProcessors(array $processors = []) | ||
{ | ||
$this->processors = []; | ||
foreach (array_reverse($processors) as $processor) { | ||
$this->pushProcessor($processor); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service_name: travis-ci | ||
coverage_clover: tests/.coverage.xml | ||
json_path: tests/.coverage.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
Tester\Environment::setup(); | ||
date_default_timezone_set('Europe/Prague'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Tests\Cases; | ||
|
||
require __DIR__ . '/../bootstrap.php'; | ||
|
||
use Grapesc\GrapeFluid\Logger; | ||
use Monolog\Processor\IntrospectionProcessor; | ||
use Monolog\Processor\WebProcessor; | ||
use Tester\Assert; | ||
use Tester\TestCase; | ||
|
||
|
||
class SetProcessorTest extends TestCase | ||
{ | ||
|
||
public function testSetProcessor() | ||
{ | ||
$logger = new Logger("Test"); | ||
$logger->setProcessors([ | ||
new IntrospectionProcessor(\Monolog\Logger::INFO), | ||
new WebProcessor | ||
]); | ||
|
||
$processor = $logger->getProcessors(); | ||
|
||
Assert::count(2, $processor); | ||
Assert::type(IntrospectionProcessor::class, $processor[0]); | ||
Assert::type(WebProcessor::class, $processor[1]); | ||
} | ||
|
||
} | ||
|
||
(new SetProcessorTest)->run(); |