Skip to main content
Version: 2024.3

Logging

The CoPilot bundle leverages Symfony's default Monolog logging to record messages under the copilot channel. By default, these log entries are archived in the var/logs/copilot.log file.

For more insights into configuring the logger to your needs, we recommend consulting the official documentation available at Symfony's monolog docs.

Using the Logger

When logging messages within your own code, you can seamlessly integrate with the provided logger from the CoPilot bundle. This logger is conveniently accessible as a service within the container and therefore can be easily injected into your classes using dependency injection mechanisms.

<?php

use Psr\Log\LoggerInterface;

class LogExample
{
public function __construct
(
private readonly LoggerInterface $pimcoreCopilotLogger,
) {
}

public function logInfoMessage(): void
{
$this->pimcoreCopilotLogger->info("This is an info message");
}
}