PHP code example of exewen / logger

1. Go to this page and download the library: Download exewen/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/ */

    

exewen / logger example snippets


!defined('BASE_PATH_PKG') && define('BASE_PATH_PKG', dirname(__DIR__, 1));

# 初始化DI
$app      = ApplicationContext::getContainer();
$app->setProviders([LoggerProvider::class]);
$this->app = $app;

/** @var LoggerInterface $logger */
$logger = $this->app->get(LoggerInterface::class);
$logger->info("info日志");
$logger->debug("debug日志");
$logger->error("error日志");

# info
LoggerFacade::info("info日志");
# error
LoggerFacade::error("error日志");
# warning
LoggerFacade::warning("warning日志");
# notice
LoggerFacade::notice("notice日志");
# debug
LoggerFacade::debug("debug日志");
# request
LoggerFacade::request("request日志");