PHP code example of los / loslog
1. Go to this page and download the library: Download los/loslog library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
los / loslog example snippets
return [
'dependencies' => [
'factories' => [
LosMiddleware\LosLog\LosLog::class => LosMiddleware\LosLog\LosLogFactory::class,
],
'delegators' => [
ErrorHandler::class => [
LosMiddleware\LosLog\ErrorHandlerListenerDelegatorFactory::class,
],
],
],
];
return [
'middleware_pipeline' => [
'before' => [
'middleware' => [
LosMiddleware\LosLog\HttpLog::class,
],
'priority' => 10000,
],
],
];
'http_logger_file' => 'http.log',
'log_request' => true,
'log_response' => true,
'full' => false,
return [
'middleware_pipeline' => [
'before' => [
'middleware' => [
LosMiddleware\RequestId\RequestId::class,
LosMiddleware\LosLog\HttpLog::class,
LosMiddleware\ResponseTime\ResponseTime::class
],
'priority' => 10000,
],
],
];
chdir(dirname(__DIR__));
rorLogger::registerHandlers();
Laminas\Mvc\Application::init(
chdir(dirname(__DIR__));
iner\ContainerInterface $container */
$container =
/* @var \Mezzio\Application $api */
$app = $container->get('Mezzio\Application');
$app->run();
\LosLog\Log\ErrorLogger::registerHandlers();
chdir(dirname(__DIR__));
ceptionLogger::registerHandlers('exception.log', '/tmp');
Laminas\Mvc\Application::init(
chdir(dirname(__DIR__));
iner\ContainerInterface $container */
$container = /tmp');
/* @var \Mezzio\Application $api */
$app = $container->get('Mezzio\Application');
$app->run();
\LosMiddleware\LosLog\StaticLogger::save("Test message");
\LosMiddleware\LosLog\StaticLogger::save("Test message 2", 'test.log');
\LosMiddleware\LosLog\StaticLogger::save($myObj);
\LosMiddleware\LosLog\StaticLogger::save("Test message", null);
bash
php composer.phar