2017 © Pedro PelĂĄez
 

library loggers

A collection of PSR-3 loggers.

image

jitesoft/loggers

A collection of PSR-3 loggers.

  • Sunday, March 25, 2018
  • by JiteSoft
  • Repository
  • 1 Watchers
  • 1 Stars
  • 198 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

Loggers

pipeline status coverage report Back project PHP-Version, (*1)

Packagist PHP Version (2.x.x/dev-php-7) Packagist PHP Version (3.x.x/dev-php-8) Packagist PHP Version (4.x.x/dev-master), (*2)

This repository contains a set of loggers implementing the PSR-3 logger interface.
Pull-requests and feature requests welcome., (*3)

Php7 and Php8

v2.x tags requires php 7+
v3.x tags requires php 8+
v4.x tags requires php 8.1+, (*4)

Only latest (currently php8.1+) is maintained., (*5)

Implemented loggers

All loggers are able to set which logging levels they should actually log on via the setLogLevel method., (*6)

StdLogger

Logs output to stdout and stderr.
It's possible to change the format of the output and of the timestamp via the setFormat and setTimeFormat methods in the instance class., (*7)

FileLogger

The FileLogger is probably the most useful logger. All it does is to print the output to a file of choice (defaults to /tmp/log.txt).
It's (as with StdLogger) possible to change the format of the output and of the timestamp., (*8)

JsonLogger

The JsonLogger is a StdLogger which logs a json object instead of the standard formatted string.
The json object looks as the following:, (*9)

{ "severity": "error", "message": "Formatted message.", "context": { }, "time": "1977-04-22T06:00:00Z", "ts": 230533200 }

JsonFileLogger

The JsonFileLogger is a FileLogger which logs a json object instead of the standard formatted string. Each log entry will be a new object, the following format is used:, (*10)

{ "severity": "error", "message": "Formatted message.", "context": { }, "time": "1977-04-22T06:00:00Z", "ts": 230533200 }

PDOLogger

Logs output to a PDO connection of choice. The table that it expects to add data to should look like the following:, (*11)

level   - varchar(255)
message - text
time    - datetime

Convenience method:, (*12)

CREATE TABLE IF NOT EXISTS log_messages (`level` int, `message` TEXT, `time` TIME )

SysLogLogger

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..., (*13)

Internally it uses the php syslog and openlog methods. Check the constructor docs for default values., (*14)

MultiLogger

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) and removeLogger(LoggerInterface|string $logger), (*15)

CallbackLogger

The CallbackLogger is basically just a callback which gets invoked on log. The callback is passed the following arguments:, (*16)

string: loglevel
string: message (message with context placeholders replaced)
string: text (message without context placeholders replaced)
array:  context

CompactJsonLogger

Logger using (Compact Log Event Format JSON)[https://clef-json.org/] output to streams., (*17)

Output format:, (*18)

{"@t":"DateTime as ISO8601 String","@l":"(int)level","@m":"Formatted message","@mt":"Message template","@r": {"context-key": "context-value"}}

CompactJsonFileLogger

Logger using (Compact Log Event Format JSON)[https://clef-json.org/] output to file., (*19)

{"@t":"DateTime as ISO8601 String","@l":"(int)level","@m":"Formatted message","@mt":"Message template","@r": {"context-key": "context-value"}}

License, (*20)

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.

The Versions

25/03 2018

dev-master

9999999-dev

A collection of PSR-3 loggers.

  Sources   Download

MIT

The Requires

 

The Development Requires

25/03 2018

1.1.1

1.1.1.0

A collection of PSR-3 loggers.

  Sources   Download

MIT

The Requires

 

The Development Requires

25/03 2018

1.1.0

1.1.0.0

A collection of PSR-3 loggers.

  Sources   Download

MIT

The Requires

 

The Development Requires

22/12 2017

1.0.0

1.0.0.0

A collection of PSR-3 loggers.

  Sources   Download

MIT

The Requires

 

The Development Requires