RomanL 6 лет назад
Родитель
Сommit
1bbd26e5e5

+ 6 - 22
modules/base/payment/classes/BxBaseModPaymentProvider.php

@@ -34,8 +34,6 @@ class BxBaseModPaymentProvider extends BxDol
     protected $_bUseSsl;
     protected $_bRedirectOnResult;
 
-    protected $_sLogFile;
-
     /**
      * Is needed to translate status received from Payment Provider 
      * to internal one. 
@@ -58,8 +56,6 @@ class BxBaseModPaymentProvider extends BxDol
         $this->_sCaption = _t($aConfig['caption']);
         $this->_sPrefix = $aConfig['option_prefix'];
 
-        $this->_sLogFile = BX_DIRECTORY_PATH_LOGS . 'bx_pp_' . $this->_sName . '.log';
-
         $this->_aSbsStatuses = array();
 
         $this->_iVendor = 0;
@@ -188,24 +184,12 @@ class BxBaseModPaymentProvider extends BxDol
 	 */
 	protected function log($sContents)
 	{
-		try {
-			if($this->_sLogFile != '')
-				$file = $this->_sLogFile;
-	    	else 
-				$file = dirname(__FILE__) . '/bx_pp_' . $this->_sName . '.log';
-	
-			file_put_contents($file, date('m-d H:i:s').": ", FILE_APPEND);
-	
-			if (is_array($sContents))
-				$sContents = var_export($sContents, true);	
-			else if (is_object($sContents))
-				$sContents = json_encode($sContents);
-	
-			file_put_contents($file, $sContents."\n", FILE_APPEND);
-	  	} 
-	  	catch (Exception $e) {
-			echo 'Error: ' . $e->getMessage();
-	  	}
+		if (is_array($sContents))
+			$sContents = var_export($sContents, true);	
+		else if (is_object($sContents))
+			$sContents = json_encode($sContents);
+		
+		bx_log('bx_pp_' . $this->_sName, $sContents);
 	}
 }
 

+ 7 - 9
modules/boonex/elasticsearch/classes/BxElsApi.php

@@ -238,15 +238,13 @@ class BxElsApi extends BxDol
     {
         if (!defined('BX_ELASTICSEARCH_LOG') || !constant('BX_ELASTICSEARCH_LOG'))
             return;
-        $fn = BX_DIRECTORY_PATH_ROOT . "logs/elasticsearch.log";
-        $f = @fopen ($fn, 'a');
-        if (!$f)
-            return;
-        if (is_array($mixed))
-            fwrite ($f, date(DATE_RFC822) . "\n" . print_r($mixed, true) . "\n");
-        else
-            fwrite ($f, date(DATE_RFC822) . "\t" . $mixed . "\n");
-        fclose ($f);
+        
+		if (is_array($mixed))
+			$mixed = var_export($mixed, true);	
+		else if (is_object($mixed))
+			$mixed = json_encode($mixed);
+		
+		bx_log('bx_elasticsearch', $mixed);
     }
 }
 

+ 1 - 5
modules/boonex/profiler/classes/BxProfiler.php

@@ -134,11 +134,7 @@ class BxProfiler extends BxDol
 
     function _appendToLog ($s)
     {
-        $f = fopen ( BX_DIRECTORY_PATH_ROOT . 'logs/bx_profiler.log', 'a');
-        if (!$f)
-            return;
-        fwrite($f, $s);
-        fclose($f);
+		bx_log('bx_profiler', $s);
     }
 
     function logSqlQuery ($iTime, $aSqlQuery, &$oStmt)

+ 0 - 9
modules/boonex/stripe_connect/classes/BxStripeConnectConfig.php

@@ -19,8 +19,6 @@ class BxStripeConnectConfig extends BxBaseModConnectConfig
     protected $_sApiPublicKey;
     protected $_sApiSecretKey;
 
-	protected $_sLogFile;
-
     function __construct($aModule)
     {
         parent::__construct($aModule);
@@ -68,8 +66,6 @@ class BxStripeConnectConfig extends BxBaseModConnectConfig
         $this->_aJsObjects = array(
         	'main' => 'oStripeConnectMain',
         );
-
-        $this->_sLogFile = BX_DIRECTORY_PATH_LOGS . 'bx_stripe_connect.log';
     }
 
     public function init(&$oDb)
@@ -140,11 +136,6 @@ class BxStripeConnectConfig extends BxBaseModConnectConfig
 
         return $iResult;
     }
-
-    public function getLogFile()
-    {
-    	return $this->_sLogFile;
-    }
 }
 
 /** @} */

+ 6 - 17
modules/boonex/stripe_connect/classes/BxStripeConnectModule.php

@@ -502,23 +502,12 @@ class BxStripeConnectModule extends BxBaseModConnectModule
 
 	protected function _log($sContents)
 	{
-		try {
-			$sFile = $this->_oConfig->getLogFile();
-			if(empty($sFile))
-				$sFile = dirname(__FILE__) . "/bx_stripe_connect.log";
-	
-			file_put_contents($sFile, date('m-d H:i:s') . ": ", FILE_APPEND);
-	
-			if (is_array($sContents))
-				$sContents = var_export($sContents, true);	
-			else if (is_object($sContents))
-				$sContents = json_encode($sContents);
-	
-			file_put_contents($sFile, $sContents . "\n", FILE_APPEND);
-	  	} 
-	  	catch (Exception $oException) {
-			echo "Error: " . $oException->getMessage();
-	  	}
+		if (is_array($sContents))
+			$sContents = var_export($sContents, true);	
+		else if (is_object($sContents))
+			$sContents = json_encode($sContents);
+		
+		bx_log('bx_elasticsearch', $sContents);
 	}
 }