delboy1978uk / bone-log
Log package for Bone Framework
Installs: 1 442
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- delboy1978uk/barnacle: ^2.4
- monolog/monolog: ^3.5
Requires (Dev)
- codeception/codeception: ^5.1
- codeception/module-asserts: ^3.0
- roave/security-advisories: dev-latest
README
Log package for Bone Framework
installation
bone-log is a core dependency of Bone Framework, as so comes installed as standard. See config/bone-log.php
in the
skeleton project
usage
To get a logger into your controllers, make them implement Bone\Log\LoggerAwareInterface
, and use the trait
Bone\Log\Traits\HasLoggerTrait
.
<?php namespace Whatever; use Bone\Controller\Controller; use Bone\Log\LoggerAwareInterface; use Bone\Log\Traits\HasLoggerTrait; class WhateverController extends Controller implements LoggerAwareInterface { use HasLoggerTrait; // your code here }
Then in your package registration class, pass your controller
into Bone\Controller\Init::controller()
:
return Init::controller(new WhateverController(), $c);
You can now call $this->getLogger();
and you will now have your PSR-3 logger at your disposal. See monolog/monolog
for details.