本文整理汇总了PHP中Monolog\Logger::pushhandler方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::pushhandler方法的具体用法?PHP Logger::pushhandler怎么用?PHP Logger::pushhandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monolog\Logger
的用法示例。
在下文中一共展示了Logger::pushhandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Logger
$dotenv = new Dotenv\Dotenv('../', ".env.php");
$dotenv->load();
/*
--MONOLOG
*/
//create loggers
$mainlogger = new Logger(getenv('MAIN_LOG'));
$pushlogger = new Logger(getenv('PUSH_OVER_LOG'));
//formatter
$outputFormat = getenv('LOG_OUTPUT_FORMAT');
$dateformat = getenv('LOG_DATE_FORMAT');
$lineformatter = new LineFormatter($outputFormat, $dateformat, true, true);
//set/add handlers
$mainhandler = new StreamHandler(getenv('LOG_FILE'), Logger::DEBUG);
$mainhandler->setFormatter($lineformatter);
$mainlogger->pushhandler($mainhandler);
//check post
if (!(isset($_POST['sessionId']) && isset($_POST['direction']) && isset($_POST['isActive']) && isset($_POST['callerNumber']) && isset($_POST['destinationNumber']))) {
$mainlogger->warning("Access from non-IVR client, ip=" . $_SERVER['REMOTE_ADDR']);
exit(0);
}
//Get POST data sent to this callbackurl from Africa Is Talking (AIT) API
$sessionID = $_POST['sessionId'];
$direction = $_POST['direction'];
//direction of call, can be 'Inbound' or 'Outbound'
$isCallActive = intval($_POST['isActive']);
//determines if call is active/on-going (1) or not/ended (0)
$callerNumber = $_POST['callerNumber'];
//number that has called SafePal service
$aitNumber = $_POST['destinationNumber'];
//redis