• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python log.PLOG类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: scanFile

def scanFile(rootpath,filetype):
    PLOG.debug('Type["%s"] file start crawling...dir = %s ' %(filetype,rootpath))
    outputjsfilename = ""
    rootDirname = ""
    if rootpath[-1] == '\\' or rootpath[-1] == '/' :
        rootpath = rootpath[:-1]
    rootDirname = os.path.split(rootpath)[-1]	
    if filetype == "movie":
        outputjsfilename = conf.movieOutputFile
    elif filetype == "app":
        outputjsfilename = conf.appOutputFile
    outputjsfilename = outputjsfilename.decode('utf8')
    rootpath = rootpath.decode('utf8')
    dirlist = enumDir(rootpath)
    allJsonInfo = {}
    allJsonInfo["update"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    allJsonInfo["source"] = conf.httpServerSite + rootDirname + '/'
    allJsonInfo["list"] =[]		    
    for subdir in dirlist:
        fileitems = enumFile(os.path.join(rootpath,subdir))
        for fileitem in fileitems:
            if fileitem[-5:] == ".json" : 	    
                addJsonInfo(fileitem,allJsonInfo)
    with open(outputjsfilename,"w") as f:
        json.dump(allJsonInfo, f,indent=4,ensure_ascii=False)
    PLOG.debug('Type["%s"] file crawl dir %s finished' %(filetype,rootpath))	
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:26,代码来源:filecrawlerUTF8统一编码版.py


示例2: openmysqlconn

def openmysqlconn():
    dboperater =None
    try:
        dboperater = DBOperater()
        dboperater.createconnection(host=sadb.host,user=sadb.dbuser,passwd=sadb.dbpwd,dbname=sadb.dbname)
    except MySQLdb.Error,e:
        PLOG.debug("Mysql Error %d: %s" %(e.args[0], e.args[1]))   
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:7,代码来源:SAPeakDataPublic.py


示例3: AddWebSocket

 def AddWebSocket(self,wsconn):
     wsname = wsconn.wsname   
     if self.websockets.has_key(wsname) :
         PLOG.debug("Already has ws connect %s,close old connect"%wsname)
         self.websockets[wsname].close()
     self.websockets[wsname] = wsconn     
     PLOG.debug("ws manager add %s"%wsname)
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:7,代码来源:PagejumpDemo.py


示例4: get

 def get(self):
     result = ""
     jsresult = {}
     cmdlist = self.get_query_arguments("cmd")
     for cmd in cmdlist:
         PLOG.debug("Receive msg %s"%cmd)
         if len(cmd) >0 :
             js = json.loads(cmd.decode('utf8'))
             if js.has_key('msgid') :
                 msg = js["msgid"]
                 if msg == "seturi":
                     if js.has_key('body'):
                         body = js["body"]
                         if body.has_key('uri'):
                             uri = body["uri"]
                             if len(uri) >0:
                                 global lastpageuri
                                 lastpageuri = uri
                                 HandleSetURI(uri)
                                 jsresult["errmsg"] = "OK"
                             else:
                                 jsresult["errmsg"] = "uri is empty!"
                         else:
                             jsresult["errmsg"] = "msg seturi body has no uri,invalid msg"
                     else:
                         jsresult["errmsg"] = "msg seturi has no body,invalid msg"                        
                 else:
                     jsresult["errmsg"] = "not support msgid " + msg
         self.write(json.dumps(jsresult))  
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:29,代码来源:PagejumpDemo.py


示例5: heartbeatCheck

 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,代码行数:8,代码来源:PagejumpDemo.py


示例6: createconnection

 def createconnection(self, host, user, passwd, dbname):
     """
     创建一个新连接
     """
     self.conn = MySQLdb.Connect(host, user, passwd, dbname, charset="utf8")
     if False == self.conn.open:
         PLOG.error("DBOperater.createconnection error")
         return -1
     return 0
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:9,代码来源:DBHelper.py


示例7: closeconnection

 def closeconnection(self):
     """
     关闭连接
     """
     if self.conn != None:
         self.conn.close()
     else:
         PLOG.error("DBOperater.closeconnection error, conn is none")
     return 0
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:9,代码来源:DBHelper.py


示例8: connection

def connection():
    global ws
    while(True):
        ws = websocket.WebSocketApp("ws://172.16.5.16:18030/ws",
                                  on_open = on_open,
                                  on_message = on_message,
                                  on_error = on_error,
                                  on_close = on_close)
        ws.run_forever()  
        PLOG.debug("ws may break")
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:10,代码来源:RockerMain.py


示例9: on_message

def on_message(ws, message):
    PLOG.debug( "Recv: "+message)
    msgJson = json.loads(message)
    global logined
    if msgJson["msgid"] == "login":
        if msgJson["errcode"] == 0:
            logined = True
        else:
            PLOG.debug("Userid is wrong,exit")
            #ws.close()
            sys.exit(0)
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:11,代码来源:RockerMain.py


示例10: addJsonInfo

def addJsonInfo(jsonSourcefile,destJson):
    filedir = os.path.dirname(jsonSourcefile)
    parentDirName = os.path.split(filedir)[-1]
    primaryFilename = ""
    jsSourceFileInfo = None
    with open(jsonSourcefile,"r") as f:
        jsSourceFileInfo = json.load(f,'utf8')	
    if jsSourceFileInfo !=None and isinstance(jsSourceFileInfo,dict):
        if jsSourceFileInfo.has_key("file"):
            primaryFilename = jsSourceFileInfo["file"]  
            if primaryFilename != "":	
                jsSourceFileInfo["id"] = str(uuid.uuid1())   
                if primaryFilename.startswith("https:") :
                    # ios info file
                    filetimestamp = time.localtime( os.path.getmtime(jsonSourcefile)) 
                    primaryFileTime = time.strftime('%Y-%m-%d %H:%M:%S',filetimestamp)
                    jsSourceFileInfo["filetime"] = primaryFileTime
                    if not jsSourceFileInfo.has_key("filesize") :
                        jsSourceFileInfo["filesize"] = "0"
                    #destJson["list"].append(jsSourceFileInfo)
                else:
                    try:
                        primaryFileSize = os.path.getsize(os.path.join(filedir,primaryFilename))
                        filetimestamp = time.localtime( os.path.getmtime(os.path.join(filedir,primaryFilename)) )
                        primaryFileTime = time.strftime('%Y-%m-%d %H:%M:%S',filetimestamp)
                        jsSourceFileInfo["filesize"] = str(primaryFileSize)
                        jsSourceFileInfo["filetime"] = primaryFileTime
                        if jsSourceFileInfo.has_key("file") :
                            jsSourceFileInfo["file"] = parentDirName +'/' + jsSourceFileInfo["file"]                        
                    except:          
                        PLOG.info("generate file info of dir %s failed,primary File %s not find,skip it"% (filedir,primaryFilename))      
                        return 
                if jsSourceFileInfo.has_key("poster") :
                    jsSourceFileInfo["poster"] = parentDirName +'/' + jsSourceFileInfo["poster"]
                if jsSourceFileInfo.has_key("thumbnail") :
                    jsSourceFileInfo["thumbnail"] = parentDirName +'/' + jsSourceFileInfo["thumbnail"]
                if jsSourceFileInfo.has_key("extend") :
                    jsextend = jsSourceFileInfo["extend"]
                    if jsextend.has_key("screenshot") :
                        jsscreenshottmp = []
                        for picture in jsextend["screenshot"] :
                            picture = parentDirName +'/' + picture
                            jsscreenshottmp.append(picture)
                        jsextend["screenshot"] =jsscreenshottmp
                destJson["list"].append(jsSourceFileInfo)
                PLOG.debug('generate file info of dir "%s" success'%(filedir))                    
                 
            else:
                PLOG.debug("generate file info of dir %s failed,primary File name is empty"% (filedir)) 

        else :
            PLOG.debug('not find "file" node in info file %s , skip it' %(jsonSourcefile))
    else:
        PLOG.warn('js file %s is null,maybe path error! skip it' %(jsonSourcefile))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:54,代码来源:filecrawler.py


示例11: getCommandForPID

 def getCommandForPID(self, pid):
     cmd = None
     try:
         processList = assistant.getProcessList()
         for p in processList:
             if p[0] == pid:
                 cmd = p[1]
                 break
         del processList
     except Exception, e:
         PLOG.error("%s getCommandForPID except:%s" % (self.name, e))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:11,代码来源:alwayson_dog.py


示例12: getPIDForString

 def getPIDForString(self, s):
     pid = None
     try:
         processList = assistant.getProcessList()
         for p in processList:
             if p[1].find(s) != -1:
                 pid = p[0]
                 break
         del processList
     except Exception, e:
         PLOG.error("%s getPIDForString except:%s" % (self.name, e))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:11,代码来源:alwayson_dog.py


示例13: login

 def login(self):  
     try:  
         FTP.connect(self,self.host,timeout=10)  
     except:  
         PLOG.warn('Can not connect to ftp server "%s"' % self.host) 
         return False  
     try:  
         FTP.login(self,self.user,self.pwd)  
     except:  
         PLOG.warn('Login ftp server "%s" failed ,username or password error' % self.host)
         return False  
     return True  
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:12,代码来源:filecrawler.py


示例14: querysql

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,代码行数:13,代码来源:SAPeakDataPublic.py


示例15: executeproc

def executeproc(procsqlname,dboperater=None,args=None):
    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) #数据库连接
        cur = dboperater.conn.cursor()
        cur.callproc(procsqlname,args)
        dboperater.conn.commit() #提交SQL语句
        cur.close()
    except MySQLdb.Error,e:
        PLOG.debug("Mysql Error %d: %s,sql=%s" %(e.args[0], e.args[1],procsqlname)) 
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:13,代码来源:SAPeakDataPublic.py


示例16: run

def run():
    init() 
    # radius 日志检查
    beforeInvoketime = datetime.datetime.now()
    currentLogFile = getCurrentLogfile()
    beforeInvokeLogFileSize = os.path.getsize(currentLogFile)
    # radius auth请求检查
    ret = InvokeProc()
    # radius auth请求检查 end
    if (ret == 1) :
        # radius 运行状态正常,检查log
        afterInvoketime = datetime.datetime.now()
        if beforeInvoketime.day == afterInvoketime.day:
            if os.path.getsize(currentLogFile) > beforeInvokeLogFileSize :
                PLOG.info("radius log status is ok")
            else:
                PLOG.info("radius log status error,no growth,stop radius")
                InvokeStopRadius()
        else:
            # 调用前后不是同一天(可能写入新日志,也可能写入旧日志,or判断)
            logfile = getCurrentLogfile()
            if ( logfile != None and len(logfile) >0 and os.path.getsize(logfile) > 0 ) or os.path.getsize(currentLogFile) > beforeInvokeLogFileSize:
                PLOG.info("radius log status is ok")
            else:
                PLOG.info("radius log status error,no growth or no new log,stop radius")
                InvokeStopRadius()
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:26,代码来源:radiusCheck.py


示例17: processRPC

 def processRPC(self, msg):
     ret = ""
     PLOG.info("RPC:\n%s" % msg)
     if msg == "status":
         ret = "alwayson working...\n"
         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
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:14,代码来源:alwayson_dog.py


示例18: init

def init():    
    configfile=assistant.SF("%s/radiusCheck.conf"%(os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config=pysmartac.configer.openconfiger(configfile)

    #configer
    conf.logLevel=config.getstr("system","logLevel",conf.logLevel)
    conf.clientPath=config.getstr("system","clientPath",conf.clientPath)
    conf.logDir=config.getstr("system","logDir",conf.logDir)
    conf.radiusIP=config.getstr("system","radiusIP",conf.radiusIP)
    conf.reponseTimeout=config.getint("system","reponseTimeout",conf.reponseTimeout)
    conf.secret=config.getstr("system","secret",conf.secret)
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/RADCK_$(Date8).log"%(os.path.dirname(__file__)))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:16,代码来源:radiusCheck.py


示例19: loadconfig

def loadconfig():
    config = ConfigParser.ConfigParser()
    configfile = assistant.SF("%s/SAPeakData.conf" % (os.path.dirname(__file__)))

    PLOG.info("Load configer file:%s" % configfile)
    config.readfp(open(configfile, "rb"))
    SAPeakDataPublic.st.loglevel = config.get("system", "loglevel")
    SAPeakDataPublic.st.queryunit = config.getint("system", "queryunit")
    SAPeakDataPublic.st.queryrepeattimes = config.getint("system", "queryrepeattimes")
    if 24%SAPeakDataPublic.st.queryunit != 0:
        PLOG.debug("queryunit is invalid,please check config!")
        sys.exit(2)
    SAPeakDataPublic.sadb.host = config.get("system", "datasource")
    SAPeakDataPublic.sadb.dbuser = config.get("system", "dbuser") 
    SAPeakDataPublic.sadb.dbpwd = config.get("system", "dbpwd")
    SAPeakDataPublic.sadb.dbname = config.get("system", "dbname")  
    SAPeakDataPublic.sadb.tablename = config.get("system", "tablename") 
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:17,代码来源:AcctPeakData.py


示例20: init

def init():    
    configfile=assistant.SF("%s/filecrawler.conf"%(os.path.dirname(__file__)))
    print os.path.dirname(__file__)
    config=pysmartac.configer.openconfiger(configfile)

    #configer
    conf.logLevel=config.getstr("system","logLevel",conf.logLevel)
    conf.httpServerSite=config.getstr("system","httpserversite",conf.httpServerSite)
    conf.movieDir=config.getstr("system","movieDir",conf.movieDir)
    conf.iosDir=config.getstr("system","iosDir",conf.iosDir)
    conf.androidDir=config.getstr("system","androidDir",conf.androidDir)
    conf.movieOutputFile=config.getstr("system","movieOutputFile",conf.movieOutputFile)
    conf.iosOutputFile=config.getstr("system","iosOutputFile",conf.iosOutputFile) 
    conf.androidOutputFile=config.getstr("system","androidOutputFile",conf.androidOutputFile) 
    config.save()
    #log settings
    PLOG.setlevel(conf.logLevel)
    PLOG.enableFilelog("%s/log/FLCRAWLER_$(Date8)_$(filenumber2).log"%(os.path.dirname(__file__)))
开发者ID:zhangqiaoli,项目名称:pythonTool,代码行数:18,代码来源:filecrawler.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python idehelper.detectCompletionType函数代码示例发布时间:2022-05-26
下一篇:
Python py2.ul函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap