dev-master
9999999-devPSR-3 complaint logger for use with Composer IOInterface
MIT
The Requires
- php >=5.6.0
- psr/log ~1.0
- composer/composer ~1.2.0
The Development Requires
by Grzegorz Zdanowski
Wallogit.com
2017 © Pedro Peláez
PSR-3 complaint logger for use with Composer IOInterface
While the code will (most likely) still work with Composer v1, this project is not maintained since 2016., (*1)
Small, fast and PSR-3 compliant logging library useful with custom Composer scripts., (*2)
Add package to require-dev and use ;-), (*3)
Initialize Logger object in your Composer hook and optionally set custom verbosity levels - evetyhing else is automatic., (*4)
Available methods:
* emergency/alert/...(message, context) - Every log level have method named after it. So if you want to log "warning" just use Logger->warning("Be warned!"). Second argument can be array with any information possible to represent as string by (formatted by print_r()).
* log(level, message, context) - It have the same effect as methods described below, so calling Logger->log("warning", "Be warned!") produces the same result as example above., (*5)
Logger comes preconfigured by default, but allows to configure almost anything. List below specifies configuration methods along with default values (specified in brackets).
* setLineFormat(<%1$s> [%2$s] %3$s [%4$s] [%5$s]) - How line should be formated. You can use 6 modifiers:
* %1$s - date
* %2$s - log level (uppercased)
* %3$s - message text
* %4$s - context (formatted by print_r())
* %1$d - unix timestamp
* setDatetimeFormat(d.m.Y H:i:s) - It accepts any date() compliant format.
* setLevelVerbosity(level, value) - In fact PSR-3 states custom log levels are forbidden, but this logger supports them. By default messages with custom level uses verbosity defined by IOInterface::NORMAL. This method allows setting custom one (and even change builtin levels verbosity, which is NOT recommended)., (*6)
PSR-3 complaint logger for use with Composer IOInterface
MIT