This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Simple PSR-3 compliant file logger

1.2.0 2020-07-07 08:09 UTC

This package is auto-updated.

Last update: 2021-11-07 11:01:33 UTC


Component for use in personal projects.


$ composer require umonkey/php-file-logger


$logger = new Umonkey\Logger\FileLogger([
    'path' => __DIR__ . '/../var/app-%Y%m%d-%H.log',
    // Optional:
    'symlink' => __DIR__ . '/../var/app.log',
    'keep_files' => 7,  // defaults to 10
    'mode' => 0664,  // defaults to 0640

$logger->info('Hello, world.');

Log buffer

All messages are kept in an internal buffer. You can get its contents using getBuffer(). This is handy if you want to log a complete log report to a database, or avoid interpolation with other messages.

Change log

2020-07-07, v 1.1.0:

  • Added log rotation, set permissions, create symlinks.
  • Added log buffer.

2020-06-17, v 1.0.1:

  • On CLI, duplicate output to stderr.


  • Log rotation.
  • Keep session logs in a buffer.