use Monolog\Logger; use Monolog\Handler\StreamHandler; // Create a logger instance $log = new Logger('name'); // Add a stream handler to the logger $log->pushHandler(new StreamHandler('path/to/your.log', Logger::INFO)); // Use the logger to log an informational message $log->info('An informational message');
use Monolog\Logger; use Monolog\Handler\StreamHandler; // Create a logger instance $log = new Logger('name'); // Add a stream handler to the logger $log->pushHandler(new StreamHandler('path/to/your.log', Logger::INFO)); // Use the logger to log an informational message with context $log->info('User {user} logged in', array('user' => 'John Doe'));In the above examples, the "logInfo" function is implemented using the "info" method provided by the Monolog library Logger class. The first parameter is the message to be logged, and the second optional parameter is an array of additional context data to be included in the log. The log file path and logging level are specified when adding a StreamHandler to the logger.