Channels

THIS IS DEPRECATED according to the API documentation.

By default, the static add methods everything to a single Application channel. That's because it's always custom code that's using this method to log. The core uses a more complex method, which enables it to log messages to specific channels. Developers can do this too.

To log a message to a specific channel, we need to actually create an instance of the Concrete\Core\Logging\Logger class. This is the class used by the Log facade. The Log facade simply creates an instance of this class attached to the application channel. Let's say we have an add-on named "ShoppingCart" and we want to log something to the "shopping_cart" channel.

First, add

use Concrete\Core\Logging\Logger;

to the header of the PHP script you're adding the logging to.

Then instantiate the logger.

$logger = new Logger('shopping_cart');
$logger->addNotice('User has bought something.');
$logger->addWarning('User abandoned cart!');

That's it! Each one of these calls will add a new log entry with the specific severity to the shopping_cart channel.