/** * provides aspect functionality * @param object $pObj object to configure * @param AOP\AJoinPoint $pJoinPoint joinpoint */ public static function advice($pObj, AOP\AJoinPoint $pJoinPoint) { $method = \property_exists($pJoinPoint, 'METHOD') ? $pJoinPoint->METHOD : ''; $args = \property_exists($pJoinPoint, 'ARGS') ? $pJoinPoint->ARGS : array(); switch ($pJoinPoint->DIRECTION) { case AOP\AJoinPoint::DIRECTION_IN: $indent = \str_repeat(CFileLogging::LOG_INDENT, CFileLogging::$INDENT_COUNT); CFileLogging::$INDENT_COUNT += 1; switch (true) { case $pJoinPoint instanceof AOP\JoinPoints\CConstructor: case $pJoinPoint instanceof AOP\JoinPoints\CDestructor: $content = sprintf('%s%s %s', $indent, $pJoinPoint->LABEL, $pJoinPoint->CLASS); break; case $pJoinPoint instanceof AOP\JoinPoints\CException: $content = sprintf('%s%s %s %s', $indent, $pJoinPoint->LABEL, $pJoinPoint->CLASS, $pJoinPoint->MESSAGE); break; case $pJoinPoint instanceof AOP\JoinPoints\CClassLoader: $content = sprintf('%s%s %s from frile %s', $indent, $pJoinPoint->LABEL, $pJoinPoint->CLASS, $pJoinPoint->file); break; case $pJoinPoint instanceof AOP\JoinPoints\CMethodCall: $strArgs = array(); foreach ($args as $argument) { if (\is_object($argument)) { $strArgs[] = \get_class($argument); } else { $strArgs[] = (string) $argument; } } $content = sprintf('%senter %s %s->%s(%s)', $indent, $pJoinPoint->LABEL, $pJoinPoint->CLASS, $method, \implode(',', $strArgs)); break; default: $content = sprintf('%senter %s->%s(%s)', $indent, $pJoinPoint->CLASS, $method, \implode(',', $args)); } break; case AOP\AJoinPoint::DIRECTION_OUT: CFileLogging::$INDENT_COUNT -= 1; $indent = \str_repeat(CFileLogging::LOG_INDENT, CFileLogging::$INDENT_COUNT); switch (true) { case $pJoinPoint instanceof AOP\JoinPoints\CMethodCall: $content = sprintf('%sleave %s %s->%s', $indent, $pJoinPoint->LABEL, $pJoinPoint->CLASS, $method); break; case $pJoinPoint instanceof AOP\JoinPoints\CConstructor: case $pJoinPoint instanceof AOP\JoinPoints\CDestructor: case $pJoinPoint instanceof AOP\JoinPoints\CClassLoader: case $pJoinPoint instanceof AOP\JoinPoints\CException: default: break; } break; } if (isset($content) && $content != '') { \Savant\CBootstrap::log($content); } }
/** * connect to defined database driver * @param string $pConn */ public function _connect() { if (!$this->isConnected()) { try { $this->con = \Savant\AGenericCallInterface::call((string) $this->DRIVER_CLASS, 'connect', array($this)); \Savant\CBootstrap::log(\Savant\Utils\CFileLogging::getIndent() . "connect to " . $this->confSection . " as " . $this->USERNAME); } catch (EDatabase $e) { throw $e; } } else { return; } }
/** * Constructor * @param string $pMessage error message * @param string $pLevel error level * @param array $pArgs arguments used by message */ public function __construct() { $args = \func_get_args(); $message = \array_shift($args); if (count($args) > 0) { parent::__construct(vsprintf($message, $args)); } else { parent::__construct($message); } if (CBootstrap::$PERMANENT_LOG) { if (CBootstrap::$STATUS == CBootstrap::STATUS_ACTIVE) { $joinPoint = new AOP\JoinPoints\CException($this); AOP\AFramework::weave(null, $joinPoint); } else { CBootstrap::log($this->getMessage()); } } }