Logger
NghiaNV 7/8/2021
# Description
- Sử dụng pakage Monolog (opens new window)
- Register Service tại
LoggerServiceProvider.php
# Config:
# app.yml
log:
dir: logs
file: nin.log
1
2
3
4
5
2
3
4
5
# Usage:
Type-hinting ConfigContract:
<?php namespace Nin\Controllers; use Nin\Libs\Logger\LoggerContract; class FooController { protected LoggerContract $log; public function __construct(LoggerContract $log) { $this->log = $log; } public function indexAction() { $this->log->debug("foo log"); } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20Facade:
use Nin\Libs\Facades\Log; Log::debug("foo log");
1
2
3
Packagist: https://packagist.org/packages/nin/nin (opens new window)