当前位置: 首页>>代码示例>>Python>>正文


Python PLOG.trace方法代码示例

本文整理汇总了Python中pysmartac.log.PLOG.trace方法的典型用法代码示例。如果您正苦于以下问题:Python PLOG.trace方法的具体用法?Python PLOG.trace怎么用?Python PLOG.trace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pysmartac.log.PLOG的用法示例。


在下文中一共展示了PLOG.trace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: heartbeatCheck

# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import trace [as 别名]
 def heartbeatCheck(self):
     if self.isTimeOut():
         PLOG.debug("%s websocket timeout,disconnect it"%self.wsname) 
         self.close()
         WSManager.RemoveWebSocket(self.wsname)
     else:
         PLOG.trace("send ping")
         self.ping("ping")
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:10,代码来源:PagejumpDemo.py

示例2: querysql

# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import trace [as 别名]
def querysql(sqltext,dboperater=None,how = 0):
    resultls = []
    try:
        if dboperater == None:
            dboperater = DBOperater()
        if dboperater.conn == None:
            dboperater.createconnection(host=sadb.host,user=sadb.dbuser,passwd=sadb.dbpwd,dbname=sadb.dbname) #数据库连接
        rowNum, result = dboperater.query(sqltext)
        PLOG.trace("%s query finish"%(sqltext))
        resultls = dboperater.fetch_queryresult(result,rowNum, how = how) 
    except MySQLdb.Error,e:
        PLOG.debug("Mysql Error %d: %s,sql=%s" %(e.args[0], e.args[1],sqltext)) 
        return None
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:15,代码来源:SAPeakDataPublic.py

示例3: CF

# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import trace [as 别名]
            items = []
            for p in self.programlist:
                items.append((p.name, p.status))
            fmt = '%-40s %9s'
            ret = '\n'.join([fmt % (x, '[%s]' % y) for x, y in items])
            PLOG.info("report runing status:\n%s" % ret)
        elif msg == "stop":
            pass
        return ret
class CF:
    pass
if __name__ == "__main__":
    conf = CF()
    conf.host = "127.0.0.1"
    conf.port = 24001
    PLOG.trace(assistant.SF("%s/log/ALS_$(Date8)_$(filenumber2).log" % (os.path.dirname(__file__))))
    PLOG.enableFilelog("%s/log/ALS_$(Date8)_$(filenumber2).log" % (os.path.dirname(__file__)))
    try:
        parentpid = os.getppid()
    except:
        print "no parent id!"
        sys.exit(1)
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    try:
        s.bind((conf.host, conf.port))
        s.settimeout(1)
    except Exception, e:
        print("绑定UDP端口失败,Host=%s,Port=%d,err=%s" % (conf.host, conf.port, e))
        sys.exit(1)
    print ("Start listen UDP[%s:%d]..." % (conf.host, conf.port))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:33,代码来源:alwayson_dog.py

示例4: on_pong

# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import trace [as 别名]
 def on_pong(self,data):
     PLOG.trace("receive pong")
     self.updateActiveTime()
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:5,代码来源:PagejumpDemo.py

示例5: on_message

# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import trace [as 别名]
 def on_message(self, message):
     PLOG.trace("receive msg %s"%message)
     self.updateActiveTime()
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:5,代码来源:PagejumpDemo.py

示例6: statisticsCurrentDayData

# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import trace [as 别名]
def statisticsCurrentDayData(daydate) :
    nextday = daydate+datetime.timedelta(days=1)
    startquerytime = daydate
    endquerytime = daydate+datetime.timedelta(hours=SAPeakDataPublic.st.queryunit)
    while endquerytime<=nextday:
        acctquerysql = "select acctinputoctets,acctoutputoctets,acctstarttime,acctstoptime,regionid from %s where acctstarttime>='%s' and acctstarttime<'%s'"%\
                   (SAPeakDataPublic.sadb.tablename,startquerytime.strftime('%Y-%m-%d %H:%M:%S'),endquerytime.strftime('%Y-%m-%d %H:%M:%S')) 
        PLOG.debug("sql=%s"%acctquerysql)
        startquerytime=endquerytime
        endquerytime=endquerytime+datetime.timedelta(hours=SAPeakDataPublic.st.queryunit)
        i = 0
        while i<SAPeakDataPublic.st.queryrepeattimes:            
            res = SAPeakDataPublic.querysql(acctquerysql)
            if res!=None:
                break
            else:
                i = i+1
        if i==3 or res==None:
            print("%s statistics data failed! db query appear error %d consecutive times,please execute again later!"%(daydate.strftime('%Y-%m-%d'),SAPeakDataPublic.st.queryrepeattimes))
            PLOG.info("%s statistics data failed! db query appear error %d consecutive times,please execute again later!"%(daydate.strftime('%Y-%m-%d'),SAPeakDataPublic.st.queryrepeattimes))
            return
        # 统计数据
        PLOG.trace("start statistics...")
        for row in res:
            if row[2] ==None or row[3] ==None or row[4] ==None:
                PLOG.warn("lack essential data!skip this data")
                continue          
            regionid = row[4]
            totalflow = 0
            if row[0]!=None:
                totalflow += row[0]
            if row[1]!=None:
                totalflow += row[1]
            if row[3].day > row[2].day:
                # 跨天
                endMinute = 23*60+59
            elif row[3].day < row[2].day:
                PLOG.info("stoptime day less than starttime day,invalid data,skip")
            else:
                endMinute = row[3].hour*60+row[3].minute 
            startMinute = row[2].hour*60+row[2].minute       
            #startMinute = datetime.datetime.strptime(row[2],'%Y-%m-%d %H:%M:%S')
            #endMinute = datetime.datetime.strptime(row[3],'%Y-%m-%d %H:%M:%S')
            totalMinute = endMinute-startMinute + 1
            if totalMinute <=0:
                PLOG.info("stoptime less than starttime,invalid data,skip")
                continue 
            if SAStopDefine.stopDc.stops.has_key(regionid):
                stop = SAStopDefine.stopDc.stops[regionid] 
                startindex = startMinute
                endindex = endMinute
                flowOneMinute = float(totalflow)/totalMinute/1024/1024
                index = startindex
                while index <= endindex:
                    stop.dayArray[index][0] += 1
                    stop.dayArray[index][1] += flowOneMinute
                    if stop.dayArray[index][0] > stop.peakonlinenum: 
                        stop.peakonlinenum = stop.dayArray[index][0]
                        stop.peakonlinetime = datetime.datetime(daydate.year,daydate.month,daydate.day,index/60,index%60)
                    if stop.dayArray[index][0] > stop.peakbandwidth:
                        stop.peakbandwidth = stop.dayArray[index][1]
                        stop.peakbandwidthtime = datetime.datetime(daydate.year,daydate.month,daydate.day,index/60,index%60)
                    index += 1
        PLOG.trace("statistics end")
    # 数据处理结束,输出各站点峰值数据
    for stopid,stop in stopsCentor.stops.items():
        peakbandwidth = stop.peakbandwidth*8/60
        print("%s %s %d %.2f"%(daydate.strftime('%Y-%m-%d'),stop.name,stop.peakonlinenum,peakbandwidth))
        PLOG.debug("%s %s %d %.2f %s %s"%(daydate.strftime('%Y-%m-%d'),stop.name,stop.peakonlinenum,peakbandwidth,stop.peakonlinetime.strftime('%H:%M'),stop.peakbandwidthtime.strftime('%H:%M')))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:71,代码来源:AcctPeakData.py


注:本文中的pysmartac.log.PLOG.trace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。