PHP code example of webiny / logger
1. Go to this page and download the library: Download webiny/logger 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/ */
webiny / logger example snippets
// Set component config
Logger::setConfig($pathToYourConfigFile);
// Now your logger exists in the system as a 'MyFileLogger' service.
// You can use it by either using a LoggerTrait...
$logger = $this->logger('MyFileLogger');
$logger->info('This is pretty simple!');
// ... or by using ServiceManagerTrait. Note that ServiceManager groups services by component
// So your service is called 'Logger.MyFileLogger'. When using LoggerTrait, it appends the service group for you.
$logger = $this->service('Logger.MyFileLogger');
$logger->warn('This is just a little bit longer...');