As a learning experience I am building a PHP based CMS using the FIG standards. Can someone explain to me how I should integrate PSR-3 into my project. I downloaded the source @ https://github.com/php-fig/log/tree/master/Psr/Log and I guess I am lost on how to proceed.
I don't understand what LoggerAwareInterface does. Should I modify the above source to work actually log the data how I want or does this work as a wrapper to my own log class. Any help/information would be appreciate.
P.S. I should note that the best guide I was able to find was http://phpmaster.com/logging-with-psr-3-to-improve-reusability/ (specifically the section : Using PSR-3 to Avoid the Logger Dependency) and it still didn't click for me.
Just in case someone searches and finds this I figured I should share what I've learned.
The answer I came up with is create a class called Log in your designated names space. To make things easier I simply setup my class to extend \Psr\Log\AbstractLogger. Because I did this I simply had to add a method called log with the params :
$level, $message, array $context = array()
If you didn't want do this simply create a class that has all the methods in AbstractLogger and then set it up to implment \Psr\Log\LoggerInterface
That's it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With