composer update
This commit is contained in:
parent
f6abc3dce2
commit
71dfaca858
1753 changed files with 45274 additions and 14619 deletions
57
vendor/consolidation/log/.scenarios.lock/install
vendored
Executable file
57
vendor/consolidation/log/.scenarios.lock/install
vendored
Executable file
|
@ -0,0 +1,57 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCENARIO=$1
|
||||
DEPENDENCIES=${2-install}
|
||||
|
||||
# Convert the aliases 'highest', 'lowest' and 'lock' to
|
||||
# the corresponding composer command to run.
|
||||
case $DEPENDENCIES in
|
||||
highest)
|
||||
DEPENDENCIES=update
|
||||
;;
|
||||
lowest)
|
||||
DEPENDENCIES='update --prefer-lowest'
|
||||
;;
|
||||
lock|default|"")
|
||||
DEPENDENCIES=install
|
||||
;;
|
||||
esac
|
||||
|
||||
original_name=scenarios
|
||||
recommended_name=".scenarios.lock"
|
||||
|
||||
base="$original_name"
|
||||
if [ -d "$recommended_name" ] ; then
|
||||
base="$recommended_name"
|
||||
fi
|
||||
|
||||
# If scenario is not specified, install the lockfile at
|
||||
# the root of the project.
|
||||
dir="$base/${SCENARIO}"
|
||||
if [ -z "$SCENARIO" ] || [ "$SCENARIO" == "default" ] ; then
|
||||
SCENARIO=default
|
||||
dir=.
|
||||
fi
|
||||
|
||||
# Test to make sure that the selected scenario exists.
|
||||
if [ ! -d "$dir" ] ; then
|
||||
echo "Requested scenario '${SCENARIO}' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "::"
|
||||
echo ":: Switch to ${SCENARIO} scenario"
|
||||
echo "::"
|
||||
echo
|
||||
|
||||
set -ex
|
||||
|
||||
composer -n validate --working-dir=$dir --no-check-all --ansi
|
||||
composer -n --working-dir=$dir ${DEPENDENCIES} --prefer-dist --no-scripts
|
||||
|
||||
# If called from a CI context, print out some extra information about
|
||||
# what we just installed.
|
||||
if [[ -n "$CI" ]] ; then
|
||||
composer -n --working-dir=$dir info
|
||||
fi
|
1
vendor/consolidation/log/.scenarios.lock/phpunit4/.gitignore
vendored
Normal file
1
vendor/consolidation/log/.scenarios.lock/phpunit4/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor
|
|
@ -8,26 +8,25 @@
|
|||
"email": "greg.1.anderson@greenknowe.org"
|
||||
}
|
||||
],
|
||||
"autoload":{
|
||||
"psr-4":{
|
||||
"Consolidation\\Log\\": "src"
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Consolidation\\Log\\": "../../src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Consolidation\\TestUtils\\": "tests/src"
|
||||
"Consolidation\\TestUtils\\": "../../tests/src"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0",
|
||||
"psr/log": "~1.0"
|
||||
"php": ">=5.4.5",
|
||||
"psr/log": "^1.0",
|
||||
"symfony/console": "^2.8|^3|^4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*",
|
||||
"g1a/composer-test-scenarios": "^1",
|
||||
"satooshi/php-coveralls": "^2",
|
||||
"squizlabs/php_codesniffer": "2.*",
|
||||
"symfony/console": "^4.0"
|
||||
"phpunit/phpunit": "^4.8.36",
|
||||
"g1a/composer-test-scenarios": "^3",
|
||||
"squizlabs/php_codesniffer": "^2"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"scripts": {
|
||||
|
@ -42,11 +41,6 @@
|
|||
"@lint",
|
||||
"@unit",
|
||||
"@cs"
|
||||
],
|
||||
"scenario": "scenarios/install",
|
||||
"post-update-cmd": [
|
||||
"create-scenario symfony4 'symfony/console:^4.0'",
|
||||
"create-scenario symfony2 'symfony/console:^2.8' --platform-php '5.5' --no-lockfile"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
|
@ -56,8 +50,10 @@
|
|||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
|
||||
"php": "5.4.8"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"vendor-dir": "../../vendor"
|
||||
}
|
||||
}
|
1400
vendor/consolidation/log/.scenarios.lock/phpunit4/composer.lock
generated
vendored
Normal file
1400
vendor/consolidation/log/.scenarios.lock/phpunit4/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
vendor/consolidation/log/.scenarios.lock/symfony2/.gitignore
vendored
Normal file
1
vendor/consolidation/log/.scenarios.lock/symfony2/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor
|
|
@ -8,26 +8,25 @@
|
|||
"email": "greg.1.anderson@greenknowe.org"
|
||||
}
|
||||
],
|
||||
"autoload":{
|
||||
"psr-4":{
|
||||
"Consolidation\\Log\\": "src"
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Consolidation\\Log\\": "../../src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Consolidation\\TestUtils\\": "tests/src"
|
||||
"Consolidation\\TestUtils\\": "../../tests/src"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0",
|
||||
"psr/log": "~1.0"
|
||||
"symfony/console": "^2.8",
|
||||
"php": ">=5.4.5",
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*",
|
||||
"g1a/composer-test-scenarios": "^1",
|
||||
"satooshi/php-coveralls": "^2",
|
||||
"squizlabs/php_codesniffer": "2.*",
|
||||
"symfony/console": "^2.8"
|
||||
"phpunit/phpunit": "^4.8.36",
|
||||
"g1a/composer-test-scenarios": "^3",
|
||||
"squizlabs/php_codesniffer": "^2"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"scripts": {
|
||||
|
@ -42,11 +41,6 @@
|
|||
"@lint",
|
||||
"@unit",
|
||||
"@cs"
|
||||
],
|
||||
"scenario": "scenarios/install",
|
||||
"post-update-cmd": [
|
||||
"create-scenario symfony4 'symfony/console:^4.0'",
|
||||
"create-scenario symfony2 'symfony/console:^2.8' --platform-php '5.5' --no-lockfile"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
|
@ -56,8 +50,10 @@
|
|||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "5.5"
|
||||
"php": "5.4.8"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"vendor-dir": "../../vendor"
|
||||
}
|
||||
}
|
1400
vendor/consolidation/log/.scenarios.lock/symfony2/composer.lock
generated
vendored
Normal file
1400
vendor/consolidation/log/.scenarios.lock/symfony2/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
vendor/consolidation/log/.scenarios.lock/symfony4/.gitignore
vendored
Normal file
1
vendor/consolidation/log/.scenarios.lock/symfony4/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor
|
60
vendor/consolidation/log/.scenarios.lock/symfony4/composer.json
vendored
Normal file
60
vendor/consolidation/log/.scenarios.lock/symfony4/composer.json
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "consolidation/log",
|
||||
"description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Greg Anderson",
|
||||
"email": "greg.1.anderson@greenknowe.org"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Consolidation\\Log\\": "../../src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Consolidation\\TestUtils\\": "../../tests/src"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"symfony/console": "^4.0",
|
||||
"php": ">=5.4.5",
|
||||
"psr/log": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6",
|
||||
"g1a/composer-test-scenarios": "^3",
|
||||
"php-coveralls/php-coveralls": "^1",
|
||||
"squizlabs/php_codesniffer": "^2"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"scripts": {
|
||||
"cs": "phpcs -n --standard=PSR2 src",
|
||||
"cbf": "phpcbf -n --standard=PSR2 src",
|
||||
"unit": "phpunit",
|
||||
"lint": [
|
||||
"find src -name '*.php' -print0 | xargs -0 -n1 php -l",
|
||||
"find tests/src -name '*.php' -print0 | xargs -0 -n1 php -l"
|
||||
],
|
||||
"test": [
|
||||
"@lint",
|
||||
"@unit",
|
||||
"@cs"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.1.3"
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"vendor-dir": "../../vendor"
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
17
vendor/consolidation/log/.travis.yml
vendored
17
vendor/consolidation/log/.travis.yml
vendored
|
@ -9,15 +9,18 @@ branches:
|
|||
matrix:
|
||||
include:
|
||||
- php: 7.2
|
||||
env: 'SCENARIO=symfony4 HIGHEST_LOWEST="update"'
|
||||
env: 'SCENARIO=symfony4 DEPENDENCIES=highest'
|
||||
- php: 7.1
|
||||
env: 'SCENARIO=symfony4'
|
||||
- php: 7.0.11
|
||||
env: 'HIGHEST_LOWEST="update"'
|
||||
- php: 7.0.11
|
||||
- php: 7.0
|
||||
env: 'DEPENDENCIES=highest'
|
||||
- php: 7.0
|
||||
- php: 5.6
|
||||
env: 'SCENARIO=phpunit4'
|
||||
- php: 5.5
|
||||
env: 'SCENARIO=symfony2 HIGHEST_LOWEST="update --prefer-lowest'
|
||||
env: 'SCENARIO=phpunit4'
|
||||
- php: 5.4
|
||||
env: 'SCENARIO=symfony2 DEPENDENCIES=lowest'
|
||||
|
||||
sudo: false
|
||||
|
||||
|
@ -27,10 +30,10 @@ cache:
|
|||
- $HOME/.composer/cache
|
||||
|
||||
install:
|
||||
- 'composer scenario "${SCENARIO}" "${HIGHEST_LOWEST-install}"'
|
||||
- '.scenarios.lock/install "${SCENARIO}" "${DEPENDENCIES}"'
|
||||
|
||||
script:
|
||||
- composer test
|
||||
|
||||
after_success:
|
||||
- travis_retry php vendor/bin/coveralls -v
|
||||
- 'travis_retry php vendor/bin/php-coveralls -v'
|
||||
|
|
35
vendor/consolidation/log/CHANGELOG.md
vendored
Normal file
35
vendor/consolidation/log/CHANGELOG.md
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Change Log
|
||||
|
||||
### 1.1.1: 2019-1-1
|
||||
|
||||
- Allow logger manager to manage a global style for loggers (#12)
|
||||
|
||||
### 1.1.0: 2018-12-29
|
||||
|
||||
- Add a logger manager (#11)
|
||||
- Update to Composer Test Scenarios 3 (#10)
|
||||
|
||||
### 1.0.6: 2018-05-25
|
||||
|
||||
- Use g1a/composer-test-scenarios (#9)
|
||||
|
||||
### 1.0.5: 2017-11-28
|
||||
|
||||
- Test Symfony version 2, 3 and 4 with different versions of php. (#5)
|
||||
|
||||
### 1.0.4: 2017-11-18
|
||||
|
||||
- Support for Symfony 4 by Tobias Nyholm (#4)
|
||||
|
||||
### 1.0.3: 2016-03-23
|
||||
|
||||
- Split up the log() method a bit.
|
||||
- Run code sniffer prior to running tests to ensure PSR-2 compliance.
|
||||
|
||||
### 1.0.2: 2016-03-22
|
||||
|
||||
- Remove unused components accidentally left in composer.json.
|
||||
|
||||
### 1.0.1: 2016-03-19
|
||||
|
||||
- Add a license file.
|
10
vendor/consolidation/log/LICENSE
vendored
10
vendor/consolidation/log/LICENSE
vendored
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2016 Consolidation Org Developers
|
||||
Copyright (c) 2016-2018 Consolidation Org Developers
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
@ -6,3 +6,11 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
DEPENDENCY LICENSES:
|
||||
|
||||
Name Version License
|
||||
psr/log 1.1.0 MIT
|
||||
symfony/console v2.8.49 MIT
|
||||
symfony/debug v2.8.49 MIT
|
||||
symfony/polyfill-mbstring v1.10.0 MIT
|
13
vendor/consolidation/log/README.md
vendored
13
vendor/consolidation/log/README.md
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
Improved [PSR-3](http://www.php-fig.org/psr/psr-3/) [Psr\Log](https://github.com/php-fig/log) logger based on Symfony Console components.
|
||||
|
||||
[](https://travis-ci.org/consolidation-org/log) [](https://scrutinizer-ci.com/g/consolidation-org/log/?branch=master) [](https://coveralls.io/github/consolidation-org/log?branch=master) [](https://packagist.org/packages/consolidation/log)
|
||||
[](https://travis-ci.org/consolidation/log) [](https://scrutinizer-ci.com/g/consolidation/log/?branch=master) [](https://coveralls.io/github/consolidation/log?branch=master) [](https://packagist.org/packages/consolidation/log)
|
||||
|
||||
## Component Status
|
||||
|
||||
|
@ -10,7 +10,7 @@ In use in [Robo](https://github.com/Codegyre/Robo).
|
|||
|
||||
## Motivation
|
||||
|
||||
Consolidation\Log provides a Psr-3 compatible logger that provides styled log output to the standard error (stderr) stream. By default, styling is provided by the SymfonyStyle class from the Symfony Console component; however, alternative stylers may be provided if desired.
|
||||
Consolidation\Log provides a PSR-3 compatible logger that provides styled log output to the standard error (stderr) stream. By default, styling is provided by the SymfonyStyle class from the Symfony Console component; however, alternative stylers may be provided if desired.
|
||||
|
||||
## Usage
|
||||
```
|
||||
|
@ -18,10 +18,17 @@ $logger = new \Consolidation\Log\Logger($output);
|
|||
$logger->setLogOutputStyler(new LogOutputStyler()); // optional
|
||||
$logger->warning('The file {name} does not exist.', ['name' => $filename]);
|
||||
```
|
||||
String interpolation -- that is, the substitution of replacements, such as `{name}` in the example above, is not required by Psr-3, and is not implemented by default in the Psr\Log project. However, it is recommended by PRS-3, and is often done, e.g. in the Symfony Console logger.
|
||||
String interpolation -- that is, the substitution of replacements, such as `{name}` in the example above, is not required by PSR-3, and is not implemented by default in the Psr\Log project. However, it is recommended by PRS-3, and is often done, e.g. in the Symfony Console logger.
|
||||
|
||||
Consolidation\Log supports string interpolation.
|
||||
|
||||
A logger manager can be used to delegate all log messages to one or more loggers.
|
||||
```
|
||||
$logger = new \Consolidation\Log\LoggerManager();
|
||||
$logger->add('default', new \Consolidation\Log\Logger($output));
|
||||
```
|
||||
This is useful if, for example, you need to inject a logger into application objects early (e.g. into a dependency injection container), but the output object to log to will not be available until later.
|
||||
|
||||
## Comparison to Existing Solutions
|
||||
|
||||
Many Symfony Console compoenents use SymfonyStyle to format their output messages. This helper class has methods named things like `success` and `warning`, making it seem like a natural choice for reporting status.
|
||||
|
|
62
vendor/consolidation/log/composer.json
vendored
62
vendor/consolidation/log/composer.json
vendored
|
@ -19,15 +19,15 @@
|
|||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.0",
|
||||
"psr/log": "~1.0",
|
||||
"php": ">=5.4.5",
|
||||
"psr/log": "^1.0",
|
||||
"symfony/console": "^2.8|^3|^4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*",
|
||||
"g1a/composer-test-scenarios": "^1",
|
||||
"satooshi/php-coveralls": "^2",
|
||||
"squizlabs/php_codesniffer": "2.*"
|
||||
"phpunit/phpunit": "^6",
|
||||
"g1a/composer-test-scenarios": "^3",
|
||||
"php-coveralls/php-coveralls": "^1",
|
||||
"squizlabs/php_codesniffer": "^2"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"scripts": {
|
||||
|
@ -42,21 +42,59 @@
|
|||
"@lint",
|
||||
"@unit",
|
||||
"@cs"
|
||||
],
|
||||
"scenario": "scenarios/install",
|
||||
"post-update-cmd": [
|
||||
"create-scenario symfony4 'symfony/console:^4.0'",
|
||||
"create-scenario symfony2 'symfony/console:^2.8' --platform-php '5.5' --no-lockfile"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"scenarios": {
|
||||
"symfony4": {
|
||||
"require": {
|
||||
"symfony/console": "^4.0"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.1.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"symfony2": {
|
||||
"require": {
|
||||
"symfony/console": "^2.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.36"
|
||||
},
|
||||
"remove": [
|
||||
"php-coveralls/php-coveralls"
|
||||
],
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "5.4.8"
|
||||
}
|
||||
}
|
||||
},
|
||||
"phpunit4": {
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.36"
|
||||
},
|
||||
"remove": [
|
||||
"php-coveralls/php-coveralls"
|
||||
],
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "5.4.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"platform": {
|
||||
"php": "5.6"
|
||||
"php": "7.0.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1171
vendor/consolidation/log/composer.lock
generated
vendored
1171
vendor/consolidation/log/composer.lock
generated
vendored
File diff suppressed because it is too large
Load diff
2
vendor/consolidation/log/phpunit.xml.dist
vendored
2
vendor/consolidation/log/phpunit.xml.dist
vendored
|
@ -1,7 +1,7 @@
|
|||
<phpunit bootstrap="vendor/autoload.php" colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="log">
|
||||
<directory prefix="test" suffix=".php">tests</directory>
|
||||
<directory suffix="Tests.php">tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<logging>
|
||||
|
|
28
vendor/consolidation/log/scenarios/install
vendored
28
vendor/consolidation/log/scenarios/install
vendored
|
@ -1,28 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
SCENARIO=$1
|
||||
ACTION=${2-install}
|
||||
|
||||
dir=scenarios/${SCENARIO}
|
||||
if [ -z "$SCENARIO" ] ; then
|
||||
SCENARIO=default
|
||||
dir=.
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d "$dir" ] ; then
|
||||
echo "Requested scenario '${SCENARIO}' does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "::"
|
||||
echo ":: Switch to ${SCENARIO} scenario"
|
||||
echo "::"
|
||||
echo
|
||||
|
||||
set -ex
|
||||
|
||||
composer -n validate --working-dir=$dir --no-check-all --ansi
|
||||
composer -n --working-dir=$dir ${ACTION} --prefer-dist --no-scripts
|
||||
composer -n --working-dir=$dir info
|
|
@ -1,2 +0,0 @@
|
|||
vendor
|
||||
composer.lock
|
|
@ -1 +0,0 @@
|
|||
vendor
|
2
vendor/consolidation/log/src/Logger.php
vendored
2
vendor/consolidation/log/src/Logger.php
vendored
|
@ -22,7 +22,7 @@ use Symfony\Component\Console\Input\StringInput;
|
|||
*
|
||||
* @author Greg Anderson <greg.1.anderson@greenknowe.org>
|
||||
*/
|
||||
class Logger extends AbstractLogger // extends ConsoleLogger
|
||||
class Logger extends AbstractLogger implements StylableLoggerInterface // extends ConsoleLogger
|
||||
{
|
||||
/**
|
||||
* @var OutputInterface
|
||||
|
|
121
vendor/consolidation/log/src/LoggerManager.php
vendored
Normal file
121
vendor/consolidation/log/src/LoggerManager.php
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
namespace Consolidation\Log;
|
||||
|
||||
use Psr\Log\AbstractLogger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\InvalidArgumentException;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* LoggerManager is a PSR-3 logger that can delegate
|
||||
* log messages to other loggers. This is ideal if
|
||||
* you need to inject a logger into various objects
|
||||
* in your application, but need to change the way that
|
||||
* the application logs later.
|
||||
*
|
||||
* @author Greg Anderson <greg.1.anderson@greenknowe.org>
|
||||
*/
|
||||
class LoggerManager extends AbstractLogger implements StylableLoggerInterface
|
||||
{
|
||||
/** @var LoggerInterface[] */
|
||||
protected $loggers = [];
|
||||
/** @var LoggerInterface */
|
||||
protected $fallbackLogger = null;
|
||||
/** @var LogOutputStylerInterface */
|
||||
protected $outputStyler;
|
||||
/** @var array */
|
||||
protected $formatFunctionMap = [];
|
||||
|
||||
/**
|
||||
* reset removes all loggers from the manager.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->loggers = [];
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* setLogOutputStyler will remember a style that
|
||||
* should be applied to every stylable logger
|
||||
* added to this manager.
|
||||
*/
|
||||
public function setLogOutputStyler(LogOutputStylerInterface $outputStyler, array $formatFunctionMap = array())
|
||||
{
|
||||
$this->outputStyler = $outputStyler;
|
||||
$this->formatFunctionMap = $this->formatFunctionMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* add adds a named logger to the manager,
|
||||
* replacing any logger of the same name.
|
||||
*
|
||||
* @param string $name Name of logger to add
|
||||
* @param LoggerInterface $logger Logger to send messages to
|
||||
*/
|
||||
public function add($name, LoggerInterface $logger)
|
||||
{
|
||||
// If this manager has been given a log style,
|
||||
// and the logger being added accepts a log
|
||||
// style, then copy our style to the logger
|
||||
// being added.
|
||||
if ($this->outputStyler && $logger instanceof StylableLoggerInterface) {
|
||||
$logger->setLogOutputStyler($this->outputStyler, $this->formatFunctionMap);
|
||||
}
|
||||
$this->loggers[$name] = $logger;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* remove a named logger from the manager.
|
||||
*
|
||||
* @param string $name Name of the logger to remove.
|
||||
*/
|
||||
public function remove($name)
|
||||
{
|
||||
unset($this->loggers[$name]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* fallbackLogger provides a logger that will
|
||||
* be used only in instances where someone logs
|
||||
* to the logger manager at a time when there
|
||||
* are no other loggers registered. If there is
|
||||
* no fallback logger, then the log messages
|
||||
* are simply dropped.
|
||||
*
|
||||
* @param LoggerInterface $logger Logger to use as the fallback logger
|
||||
*/
|
||||
public function fallbackLogger(LoggerInterface $logger)
|
||||
{
|
||||
$this->fallbackLogger = $logger;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function log($level, $message, array $context = array())
|
||||
{
|
||||
foreach ($this->getLoggers() as $logger) {
|
||||
$logger->log($level, $message, $context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return either the list of registered loggers,
|
||||
* or a single-element list containing only the
|
||||
* fallback logger.
|
||||
*/
|
||||
protected function getLoggers()
|
||||
{
|
||||
if (!empty($this->loggers)) {
|
||||
return $this->loggers;
|
||||
}
|
||||
if (isset($this->fallbackLogger)) {
|
||||
return [ $this->fallbackLogger ];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
16
vendor/consolidation/log/src/StylableLoggerInterface.php
vendored
Normal file
16
vendor/consolidation/log/src/StylableLoggerInterface.php
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
namespace Consolidation\Log;
|
||||
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
|
||||
/**
|
||||
* StylableLoggerInterface indicates that a logger
|
||||
* can receive a LogOutputStyler.
|
||||
*
|
||||
* @author Greg Anderson <greg.1.anderson@greenknowe.org>
|
||||
*/
|
||||
interface StylableLoggerInterface
|
||||
{
|
||||
public function setLogOutputStyler(LogOutputStylerInterface $outputStyler, array $formatFunctionMap = array());
|
||||
}
|
|
@ -3,8 +3,9 @@ namespace Consolidation\Log;
|
|||
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LogMethodTests extends \PHPUnit_Framework_TestCase
|
||||
class LogMethodTests extends TestCase
|
||||
{
|
||||
protected $output;
|
||||
protected $logger;
|
69
vendor/consolidation/log/tests/LoggerManagerTests.php
vendored
Normal file
69
vendor/consolidation/log/tests/LoggerManagerTests.php
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
namespace Consolidation\Log;
|
||||
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LoggerManagerTests extends TestCase
|
||||
{
|
||||
protected $output;
|
||||
protected $logger;
|
||||
|
||||
function testLoggerManager()
|
||||
{
|
||||
$fallbackOutput = new BufferedOutput();
|
||||
$fallbackOutput->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
$fallbackLogger = new Logger($fallbackOutput);
|
||||
$fallbackLogger->notice('This is the fallback logger');
|
||||
|
||||
$primaryOutput = new BufferedOutput();
|
||||
$primaryOutput->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
$primaryLogger = new Logger($primaryOutput);
|
||||
$primaryLogger->notice('This is the primary logger');
|
||||
|
||||
$replacementOutput = new BufferedOutput();
|
||||
$replacementOutput->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
$replacementLogger = new Logger($replacementOutput);
|
||||
$replacementLogger->notice('This is the replacement logger');
|
||||
|
||||
$logger = new LoggerManager();
|
||||
|
||||
$logger->notice('Uninitialized logger.');
|
||||
$logger->fallbackLogger($fallbackLogger);
|
||||
$logger->notice('Logger with fallback.');
|
||||
$logger->add('default', $primaryLogger);
|
||||
$logger->notice('Primary logger');
|
||||
$logger->add('default', $replacementLogger);
|
||||
$logger->notice('Replaced logger');
|
||||
$logger->reset();
|
||||
$logger->notice('Reset loggers');
|
||||
|
||||
$fallbackActual = rtrim($fallbackOutput->fetch());
|
||||
$primaryActual = rtrim($primaryOutput->fetch());
|
||||
$replacementActual = rtrim($replacementOutput->fetch());
|
||||
|
||||
$actual = "Fallback:\n====\n$fallbackActual\nPrimary:\n====\n$primaryActual\nReplacement:\n====\n$replacementActual";
|
||||
|
||||
$actual = preg_replace('# *$#ms', '', $actual);
|
||||
$actual = preg_replace('#^ *$\n#ms', '', $actual);
|
||||
|
||||
$expected = <<< __EOT__
|
||||
Fallback:
|
||||
====
|
||||
! [NOTE] This is the fallback logger
|
||||
! [NOTE] Logger with fallback.
|
||||
! [NOTE] Reset loggers
|
||||
Primary:
|
||||
====
|
||||
! [NOTE] This is the primary logger
|
||||
! [NOTE] Primary logger
|
||||
Replacement:
|
||||
====
|
||||
! [NOTE] This is the replacement logger
|
||||
! [NOTE] Replaced logger
|
||||
__EOT__;
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
|
@ -4,10 +4,11 @@ namespace Consolidation\Log;
|
|||
use Psr\Log\LogLevel;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use Consolidation\TestUtils\TestDataPermuter;
|
||||
|
||||
class LoggerVerbosityAndStyleTests extends \PHPUnit_Framework_TestCase
|
||||
class LoggerVerbosityAndStyleTests extends TestCase
|
||||
{
|
||||
protected $output;
|
||||
protected $logger;
|
Reference in a new issue