use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; class MyApplication { private $logger; public function __construct(LoggerInterface $logger) { $this->logger = $logger; } public function doSomethingCritical() { try { // code that could potentially fail } catch (Exception $e) { $this->logger->emergency("Critical system failure occurred", [ "exception" => $e, "code" => $e->getCode(), "trace" => $e->getTraceAsString(), ]); } } }In this example, we have a class `MyApplication` that takes a `LoggerInterface` object as a constructor argument. Inside one of its methods, `doSomethingCritical()`, we have some code that could potentially throw an exception. If an exception is caught, we log an emergency message with detailed information about the failure, including the exception object, error code, and stack trace. The package library for this example is the PSR-3 logging standard, which provides a common interface for logging libraries to follow in order to achieve interoperability. Some popular implementations of this standard include Monolog, Log4PHP, and Zend\Log.