BMO Methods 15
FreePBX::Logger() a PSR logging interface using monolog
<?php
include '/etc/freepbx.conf';
$logger = FreePBX::Logger();
$logger->addHandler($logger->monoLog, new Monolog\Handler\HipChatHandler("TOKEN", "FreePBX", $name = 'PBXLOG', true));
$logger->logWrite('freepbx','Testing is this thing on?');
$logger->createCustomLog('custom','/var/log/asterisk/mylog.log','INFO');
$logger->logWrite('mymodule','Testing is this thing on?',true,'WARNING'); |
Handlers can be handled by BMO Hook (see BMO Hooks )
Module: framework
Namespace: FreePBX
Module | framework |
---|---|
Namespace | FreePBX |
Class | Logger |
Method | attachHandlers |
Arguments | SPLObjectStorage $loggers |
<?php
/** your bmo class */
public function loggingHook($hookObj){
$handler = new Monolog\Handler\HipChatHandler("TOKEN", "FreePBX",'PBXLOG', true);
$hookObj->attach($handler);
}
/** Other stuff */ |