Page tree
Skip to end of metadata
Go to start of metadata

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

Moduleframework
NamespaceFreePBX
ClassLogger
MethodattachHandlers
ArgumentsSPLObjectStorage $loggers
<?php
/** your bmo class */
public function loggingHook($hookObj){
	$handler =  new Monolog\Handler\HipChatHandler("TOKEN", "FreePBX",'PBXLOG', true);
	$hookObj->attach($handler);
}
/** Other stuff */

  • No labels