A collection of PSR-3 loggers.
This repository contains a set of loggers implementing the PSR-3 logger interface.
Pull-requests and feature requests welcome.
All loggers (with the exception of the NullLogger) are able to set which logging levels they should actually log on
Logs output to stdout and stderr.
It's possible to change the format of the output and of the timestamp via the
in the instance class.
The FileLogger is probably the most useful logger. All it does is to print the output to a file of choice
It's (as with
StdLogger) possible to change the format of the output and of the timestamp.
Logs output to a PDO connection of choice. The table that it expects to add data to should look like the following:
level - varchar(255) message - text time - datetime
CREATE TABLE IF NOT EXISTS log_messages (`level` int, `message` TEXT, `time` TIME )
The SysLogLogger sends your logs to a local syslog server.
As of right now, it is not able to use a remote server, but should later on...
Internally it uses the php
openlog methods. Check the constructor docs for default values.
The MultiLogger was created to make it possible to log with multiple loggers in a single logger.
This due to the fact that you often wish to bind the logger to the LoggerInterface for dependency injection something that will not allow you to bind multiple loggers!
You can add and remove loggers via
addLogger(LoggerInterface $logger, string $name = null)
The CallbackLogger is basically just a callback which gets invoked on log. The callback is passed the following arguments:
string: loglevel string: message (message with context placeholders replaced) string: text (message without context placeholders replaced) array: context
Null logger does absolutely nothing!
MIT License Copyright (c) 2020 Jitesoft 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: 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.