www.phplogcon.org <- * ----------------------------------------------------------------- * StreamConfig has the capability to create a specific LogStream * object depending on a configured LogStream*Config object. * * All directives are explained within this file * * Copyright (C) 2008 Adiscon GmbH. * * This file is part of phpLogCon. * * PhpLogCon is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * PhpLogCon is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with phpLogCon. If not, see . * * A copy of the GPL can be found in the file "COPYING" in this * distribution. ********************************************************************* */ // --- Avoid directly accessing this file! if ( !defined('IN_PHPLOGCON') ) { die('Hacking attempt'); exit; } // --- abstract class LogStreamConfig { // Public needed properties public $_pageCount = 50; // Paging Count number! // protected properties protected $_logStreamConfigObj = null; protected $_logStreamId = -1; protected $_logStreamName = ''; protected $_defaultFacility = ''; protected $_defaultSeverity = ''; // helpers properties for message parser list! protected $_msgParserList = null; // Contains a string list of configure msg parsers protected $_msgParserObjList = null; // Contains an object reference list to the msg parsers // Constructor prototype public abstract function LogStreamFactory($o); /* * Initialize Msg Parsers! */ public function InitMsgParsers() { // Init parsers if available and not initialized already! if ( $this->_msgParserList != null && $this->_msgParserObjList == null ) { // Loop through parsers foreach( $this->_msgParserList as $szParser ) { // Set Classname $szClassName = "MsgParser_" . $szParser; // Create OBjectRef! $this->_msgParserObjList[] = new $szClassName(); } } } /* * */ public function SetMsgParserList( $szParsers ) { global $gl_root_path; // Check if we have at least something to check if ( $szParsers == null || strlen($szParsers) <= 0 ) return; // Set list of Parsers! if ( strpos($szParsers, ",") ) $aParsers = explode( ",", $szParsers ); else $aParsers[0] = $szParsers; // Loop through parsers foreach( $aParsers as $szParser ) { // Remove whitespaces $szParser = trim($szParser); // Check if parser file include exists $szIncludeFile = $gl_root_path . 'classes/msgparsers/msgparser.' . $szParser . '.class.php'; if ( file_exists($szIncludeFile) ) { // Try to include if ( @include_once($szIncludeFile) ) $this->_msgParserList[] = $szParser; else OutputDebugMessage("Error, MsgParser '" . $szParser . "' could not be included. ", DEBUG_ERROR); } } // print_r ( $this->_msgParserList ); } public function ProcessMsgParsers($szMsg, &$arrArguments) { // Process if set! if ( $this->_msgParserObjList != null ) { foreach( $this->_msgParserObjList as $myMsgParser ) { // Perform Parsing, and return if was successfull! Otherwise the next Parser will be called. if ( $myMsgParser->ParseMsg($szMsg, $arrArguments) == SUCCESS ) return SUCCESS; } } // reached this means all work is done! return SUCCESS; } } ?>