Download the PHP package geoffroy-aubry/logger without Composer
On this page you can find all versions of the php package geoffroy-aubry/logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geoffroy-aubry/logger
More information about geoffroy-aubry/logger
Files in geoffroy-aubry/logger
Package logger
Short Description PSR-3 logger for adding colors and indentation on PHP CLI output.
License LGPL-3.0+
Informations about the package logger
Colored and Indented Logger
PSR-3 logger for adding colors and indentation on PHP CLI output.
Description
Use tags and placeholder syntax to provide an easy way to color and indent PHP CLI output. PSR-3 compatibility allows graceful degradation when switching to another PSR-3 compliant logger.
Colors
-
Declare some colors:
- Use them either by exploiting placeholder syntax with
'C.'
prefix:
Or by logging message with a level equals to a color key:
It is even possible to specify color tag in the value of a placeholder:
See below for demonstration.
Indentation
You can control indentation level with indent and unindent tags:
- default tags are
'+++'
and'---'
, - both usable at the beginning or at the end of any message,
- one or more occurrences,
- can be used alone.
Example:
See below for demonstration.
Configuration
Default configuration:
Where:
colors
⇒(array)
Array of key/value pairs to associate bash color codes to color tags (see above).base_indentation
⇒(string)
Describe what is a simple indentation, e.g."\t"
.indent_tag
⇒(string)
Tag usable at the start or at the end of the message to add one or more indentation level.unindent_tag
⇒(string)
Tag usable at the start or at the end of the message to remove one or more indentation level.min_message_level
⇒(string)
Threshold required to log message, must be defined in\Psr\Log\LogLevel
.reset_color_sequence
⇒(string)
Concatenated sequence at the end of message when colors are used. For example:"\033[0m"
.color_tag_prefix
⇒(string)
Prefix used in placeholders to distinguish standard context from colors.
Demo
See demo.php script for an example:
Here is the result:
Usage
-
Class autoloading and dependencies are managed by Composer so install it following the instructions on Composer: Installation - *nix or just run the following command:
- Add dependency to
GAubry\Logger
into require section of yourcomposer.json
:
and run php composer.phar install
from the terminal into the root folder of your project.
- Include Composer's autoloader and use the
GAubry\Logger
class:
Documentation
API documentation generated by ApiGen
and included in the doc/api
folder.
Copyrights & licensing
Licensed under the GNU Lesser General Public License v3 (LGPL version 3). See LICENSE file for details.
Change log
See CHANGELOG file for details.
Continuous integration
Following commands are executed during each build and must report neither errors nor warnings:
-
Unit tests with PHPUnit:
-
Coding standards with PHP CodeSniffer:
- Code quality with PHP Mess Detector:
Git branching model
The git branching model used for development is the one described and assisted by twgit
tool: https://github.com/Twenga/twgit.