Skip to content

Instantly share code, notes, and snippets.

@sohelrana820
Created August 3, 2017 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sohelrana820/d226d867e3ae76520c068e4872363de1 to your computer and use it in GitHub Desktop.
Save sohelrana820/d226d867e3ae76520c068e4872363de1 to your computer and use it in GitHub Desktop.
Implementing CakePHP Logging Scope
<?php
/**
* @author: Sohel Rana <me.sohelrana.me>
* @author URI: http://blog.sohelrana.me
* @licence; MIT
* @link: https://blog.sohelrana.me/using-cakephp-logging-scope
*
* Implementing CakePHP Logging Scope
*/
// This will be cart scope
Log::setConfig('cart', [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'cart.log',
'levels' => [],
'scopes' => ['cart'],
'url' => env('LOG_ERROR_URL', null),
]);
// This will be payment scope
Log::setConfig('payments', [
'className' => 'Cake\Log\Engine\FileLog',
'path' => LOGS,
'file' => 'payments.log',
'levels' => [],
'scopes' => ['payments'],
'url' => env('LOG_ERROR_URL', null),
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment