use Monolog\Logger; use Monolog\Handler\StreamHandler; $log = Logger::newInstance('my_logger_name'); $log->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));
use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Logging\LoggerFactory; $loggerFactory = new LoggerFactory(); $logger = $loggerFactory->newInstance('my_logger_name', new NullLogger());In this example, we are creating a new instance of the Logging Framework's LoggerFactory class and passing in a NullLogger (which is a logger that discards all messages). In both of these examples, we are using a logging library to create a new instance of the Log interface. The specific library being used is either Monolog or Logging Framework, depending on the example.