A library of loggers that comply with PSR-3

Maintainers

Package info

github.com/programster/package-logging

pkg:composer/programster/log

Transparency log

Statistics

Installs: 1 101

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

2.2.0 2026-08-04 10:36 UTC

This package is auto-updated.

Last update: 2026-08-04 10:37:52 UTC


README

This is a PSR-3 compatible logger package that provides some abstract loggers that allow:

  • Minimum level logging (MinLevelLogger)
  • Logging to multiple loggers (MultiLogger)
  • Prefix logging - add a prefix to all messages before logging to the underlying logger.
  • CsvFileLogger - log to a CSV file.
  • JsonFileLogger - log to a JSON file.
  • File logger - wrapper that returns CsvFileLogger or JsonFileLogger depending on format specified.
  • AddedContextLogger - just as the prefix logger adds a prefix to messages in the log, this adds the provided context to the logs. Bear in mind that if you provide a context with associative keys, and that logger gets called with context that has the same key, that key/value will be overwritten.

This package provides a PHP enum for the log level to simplify things. Hopefully the PSR-3 package will provide this itself at some point in the future.

You will likely want to take advantage of one of the following additional logging packages that make use of this package.

Install

composer require programster/log

Example Usage

/**
 * Get a logger for logging all the things.
 * @return \Psr\Log\LoggerInterface
 */
public function getLogger() : \Psr\Log\LoggerInterface
{
    return new \Programster\Log\FileLogger(filepath: "/path/to/my/logs.csv");
}