hxp
2025-02-10 23abd776c72445da3af125bcb26ec13c19341b39
10382 【后台】买断版充值回调日志按小时分割;
3个文件已修改
88 ■■■■■ 已修改文件
Common/Logging.php 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Common/MultiLogging.php 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/quick/paybtmdb.php 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Common/Logging.php
@@ -13,7 +13,7 @@
const strUIDDir="UID";
global $logging;
function CreateLogging( $phpFileName , $newDate=false)
function CreateLogging( $phpFileName , $newDate=false, $writeMode=\Log4Me\DEF_WRITE_MODE)
{
    global $logging;
    if ( isset($logging) && !$newDate)
@@ -22,7 +22,7 @@
        return;
    }
    
    $logging = new \MultiLogging\MultiLogging( dirname(__FILE__)."\\..", strPhpDir, $phpFileName, $phpFileName );
    $logging = new \MultiLogging\MultiLogging( dirname(__FILE__)."\\..", strPhpDir, $phpFileName, $phpFileName, $writeMode);
    LogInfo( "Start logging for ".$phpFileName."......" );
}
Common/MultiLogging.php
@@ -1,88 +1,75 @@
<?php
namespace MultiLogging;
#创建日期:2012-4-13 下午4:10:48
#作者:zhouliang
#创建日期:2012-4-13 下午4:10:48
#作者:zhouliang
include_once 'Log4Me.php';
include_once 'BaseConfig.php';
class MultiLogging
{
    #一些指定目录时常用的定义
    #一些指定目录时常用的定义
    const strLogDir="\\InterfaceLog";
    
    #每次记录LOG同时写入到这三个log
    #每次记录LOG同时写入到这三个log
    private $m_arrayLog=null;
    
    #根目录
    #根目录
    private $m_strDirRoot='';
    
    #参数$strRootDir为根目录,指定后,以后每次新加的日志对象都会以此为根目录
    #$strFileDir,根目录的下级目录(主要是为了便于分类)
    #$strFileName,指定日志的标识符文件名
    function __construct( $strRootDir, $strFileDir, $strFileName, $strExtraInfo='' )
    #参数$strRootDir为根目录,指定后,以后每次新加的日志对象都会以此为根目录
    #$strFileDir,根目录的下级目录(主要是为了便于分类)
    #$strFileName,指定日志的标识符文件名
    function __construct($strRootDir, $strFileDir, $strFileName, $strExtraInfo = '', $writeMode = \Log4Me\DEF_WRITE_MODE)
    {
        if( bNewStyleLogging )
        {
        if (bNewStyleLogging) {
            $this->m_strDirRoot=strLogBaseDir."\\ServerLog\\".\CommFunc\GetMonth()."\\";
        }
        else
        {
        } else {
            $this->m_strDirRoot=$strRootDir;
        }
        
        #构造日志对象和数组
        #构造日志对象和数组
        
        $this->m_arrayLog=array();        
        $this->AddLogObj( $strFileDir, $strFileName, $strExtraInfo );
        $this->AddLogObj($strFileDir, $strFileName, $strExtraInfo, $writeMode);
    }
    
    #增加log对象
    public function AddLogObj( $strFileDir, $strFileName, $strExtraInfo='' )
    #增加log对象
    public function AddLogObj($strFileDir, $strFileName, $strExtraInfo = '', $writeMode = \Log4Me\DEF_WRITE_MODE)
    {
        #获得任意一个日志对象,取得它的扩展输出内容
        if( count($this->m_arrayLog) )
        {
            foreach ( $this->m_arrayLog as $log )
            {
        #获得任意一个日志对象,取得它的扩展输出内容
        if (count($this->m_arrayLog)) {
            foreach ($this->m_arrayLog as $log) {
                $strExtraInfo=$log->GetAffixStr()." ".$strExtraInfo;
                break;
            }
        }
        
        foreach( $this->m_arrayLog as $log  )
        {
        foreach ($this->m_arrayLog as $log) {
            $log->SetAffixStr( $strExtraInfo );
        }
        
        if( bNewStyleLogging )
        {
        if (bNewStyleLogging) {
            $strPhpDir=$this->m_strDirRoot.self::strLogDir."\\".date("d",time()).'\\'.$strFileDir;
        }
        else
        {
        } else {
            $strPhpDir=$this->m_strDirRoot.self::strLogDir.'\\'.$strFileDir;
        }
        $logPhpFile=new \Log4Me\Log4Me( $strPhpDir, $strFileName );
        $logPhpFile = new \Log4Me\Log4Me($strPhpDir, $strFileName, \Log4Me\DEF_LOG_LEVEL, $writeMode);
        $logPhpFile->SetAffixStr( $strExtraInfo );
        $this->m_arrayLog[$strFileName]=$logPhpFile;
    }
    
    #移除log对象,如果存在的话
    #移除log对象,如果存在的话
    private function RemoveLogObj( $logName )
    {
        $logObj=GetLogObj($logName);
        unset( $logObj );
    }
    
    #根据log名,获得Log对象
    #根据log名,获得Log对象
    public function &GetLogObj( $logName )
    {
        if( !array_key_exists( $logName, $this->m_arrayLog ) )
        {
        if (!array_key_exists($logName, $this->m_arrayLog)) {
            return null;
        }
        return $this->m_arrayLog[$logName];
@@ -90,43 +77,36 @@
    
    public function Debug( $info )
    {
        foreach( $this->m_arrayLog as $log )
        {
        foreach ($this->m_arrayLog as $log) {
            $log->Debug( $info );
        }        
    }
    
    public function Info( $info )
    {
        foreach( $this->m_arrayLog as $log )
        {
        foreach ($this->m_arrayLog as $log) {
            $log->Info( $info );
        }
    }
    
    public function Warn( $info )
    {
        foreach( $this->m_arrayLog as $log )
        {
        foreach ($this->m_arrayLog as $log) {
            $log->Warn( $info );
        }
    }
    
    public function Error( $info )
    {
        foreach( $this->m_arrayLog as $log )
        {
        foreach ($this->m_arrayLog as $log) {
            $log->Error( $info );
        }
    }
    
    public function Fatal( $info )
    {
        foreach( $this->m_arrayLog as $log )
        {
        foreach ($this->m_arrayLog as $log) {
            $log->Fatal( $info );
        }
    }
}
?>
api/quick/paybtmdb.php
@@ -19,7 +19,7 @@
// +3   从pay后面开始
// -4   去除最后的.php
$appid = substr($_SERVER['PHP_SELF'], strripos($_SERVER['PHP_SELF'], "/") + 1 + 3, -4);
\Logging\CreateLogging("quick.pay" . $appid . ".php");
\Logging\CreateLogging("quick.pay" . $appid . ".php", false, \Log4Me\WRITE_MODE_PERHOUR);
\Logging\LogInfo("CONTENT_TYPE: " . $_SERVER["CONTENT_TYPE"]);
if ($_SERVER["CONTENT_TYPE"] == "application/xml") {
    //接收传送的数据