bephp/logger

simple logging

v1.0.2 2016-01-29 05:07 UTC

This package is not auto-updated.

Last update: 2024-11-15 18:46:08 UTC


README

A terrible logger utility for PHP (syntax same as noodlehaus/logger)

Example

<?php
require __DIR__.'/logger.php';

# logger is active based on truthiness of an expression
$debug = logger('./debug.log', getenv('PHP_ENV') === 'TEST');
$debug('This will show up if PHP_ENV is set to TEST');

# logger is active based result of callable
$info = logger('./info.log', function () {
  return true;
});
$info('This should show up');

# works like printf
$name = 'noodlehaus';
$info('Hello there %s', $name);

# defaults
$always = logger('./file.log');
$always('This always gets logged.');