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


Python log.PLOG类代码示例

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


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


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