What are the implications of PSR3 guidelines on logging errors in PHP applications?

The PSR3 guidelines provide a standardized way to log errors and messages in PHP applications, making it easier to maintain and debug code. By following these guidelines, developers can ensure consistency in logging across different projects and libraries. Implementing PSR3 guidelines involves using a logger interface and various logging levels to categorize messages.

use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

class ExampleClass {
    protected $logger;

    public function __construct(LoggerInterface $logger) {
        $this->logger = $logger;
    }

    public function doSomething() {
        try {
            // code that may throw an exception
        } catch (Exception $e) {
            $this->logger->log(LogLevel::ERROR, 'An error occurred: ' . $e->getMessage());
        }
    }
}