-
-
Notifications
You must be signed in to change notification settings - Fork 2
Logger
Emanuele Minotto edited this page Nov 30, 2024
·
3 revisions
Crystal provides a logger to help developer tracking informations.
The logger is provided in two different ways based on the PHP version that's used, if it's on PHP 5 the logger is provided as a function, if it's on PHP 7 or newer versions it's provided as an object with an interface similar to the interface provided by PSR-3.
Both the implementations use syslog
, so you can manage the implementation through openlog
.
$mf(function () use ($mf) {
$logger = $mf('logger');
$logger('info', 'lorem ipsum', array(
'foo' => true,
));
$logger('debug', 'dolor sit amet');
});
$mf(function () use ($mf) {
$logger = $mf('logger');
$logger->info('lorem ipsum', [
'foo' => true,
]);
$logger->debug('dolor sit amet');
});