noodlehaus/logger

1.0.0 2016-01-29 09:27 UTC

This package is auto-updated.

Last update: 2024-11-09 12:47:44 UTC


README

A terrible logger utility for PHP.

Example

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

# use default priority = LOG_ERR and prefix map
$log = logger('./app.log');
$log(LOG_INFO, 'Application started.');
$log(LOG_NOTICE, 'Hostname is %s', 'foo');
$log(LOG_DEBUG, '1 + 1 is 2');
$log(LOG_ERR, 'OMG something went wrong!');

# more verbose logging, change some entry prefixes
$debug = logger('./app.log', LOG_DEBUG, [
  LOG_DEBUG => 'LOOK_AT_THIS'
]);

$debug(LOG_ERR, 'OMG the server is on fire!');
$debug(LOG_DEBUG, 'We should check if the server is on fire');

License

MIT