bephp/logger

简单的日志记录

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

This package is not auto-updated.

Last update: 2024-09-20 18:08:23 UTC


README

一个糟糕的PHP日志工具 (语法与 noodlehaus/logger 相同)

示例

<?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.');