本文整理汇总了Python中pysmartac.log.PLOG.debug方法的典型用法代码示例。如果您正苦于以下问题:Python PLOG.debug方法的具体用法?Python PLOG.debug怎么用?Python PLOG.debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysmartac.log.PLOG
的用法示例。
在下文中一共展示了PLOG.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openmysqlconn
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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]))
示例2: get
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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))
示例3: AddWebSocket
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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)
示例4: scanFile
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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))
示例5: heartbeatCheck
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [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")
示例6: InvokeStopRadius
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
def InvokeStopRadius():
strStopradiusCMD = "service radiusd stop"
try:
PLOG.info("call:%s\n"%(strStopradiusCMD))
stopret = os.popen(strStopradiusCMD).read()
PLOG.debug("output:%s\n"%(stopret) )
except Exception, e:
PLOG.info("执行命令失败,CMD=%s\nError=%s\n"%(strStopradiusCMD,e.args[1]))
exit(1)
示例7: connection
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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")
示例8: on_message
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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)
示例9: executeproc
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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))
示例10: querysql
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [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
示例11: loadconfig
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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")
示例12: run
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
def run():
time.sleep(5)
global logined
if logined:
global ser
while (ser.isOpen()):
text = ser.readline() # read one, with timout
if text: # check if not timeout
n = ser.inWaiting()
while n >0:
# look if there is more to read
text = text + ser.readline() #get it
n = ser.inWaiting()
PLOG.debug( text)
if logined :
processData(text)
# 50ms 读取一次数据
time.sleep(0.05)
ser.close()
示例13: InvokeProc
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
def InvokeProc():
#echo "User-Name = radiusSelfCheck, User-Password = radiusSelfCheck" | ./radclient -xxxx 127.0.0.1:1812 auth testing123
strCMD="echo \"User-Name = radiusSelfCheck,User-Password = radiusSelfCheck\" | %s -xxxx %s:1812 auth %s" % \
(conf.clientPath,conf.radiusIP,conf.secret)
try:
PLOG.info("call:%s\n"%(strCMD))
beforeInvokeAuth = int(time.time())
retstr = os.popen(strCMD).read()
afterInvokeAuth = int(time.time())
PLOG.debug("output:%s\n"%(retstr))
if ( afterInvokeAuth - beforeInvokeAuth > conf.reponseTimeout ):
PLOG.info("radius auth reponse timeout,stop radius")
InvokeStopRadius()
return 0
if(retstr.find("rad_recv:") != -1 and retstr.find("Reply-Message") != -1) :
# 收到回应
if( retstr.find("radius status is ok") != -1 ) :
# radius运行正常
PLOG.info("radius run status is ok")
return 1
else:
# radius状态不正确,关掉radius
repmsg = ""
repMsgpattern=re.compile('Reply-Message\s*=\s*(?P<repmsg>.*)\s*')
m=repMsgpattern.search(retstr)
if ( m != None and m.group('repmsg') != None):
repmsg = m.group('repmsg')
PLOG.info("radius run status error,errmsg = %s ,stop radius" % repmsg)
InvokeStopRadius()
return 0
else:
# radius状态不正确,关掉radius
PLOG.info("radius run status error,no response,stop radius")
InvokeStopRadius()
return 0
except Exception, e:
PLOG.info("执行命令失败,CMD=%s\nError=%s\n"%(strCMD,e.args[1]))
exit(1)
示例14: executearrsql
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
def executearrsql(sqltext,dboperater=None,arrsql=None,sqlnum=100,mode = DBHelper.CURSOR_MODE):
try:
if dboperater == None:
dboperater = DBOperater()
if dboperater.conn == None:
dboperater.createconnection(host=sadb.host,user=sadb.dbuser,passwd=sadb.dbpwd,dbname=sadb.dbname) #数据库连接
if arrsql!=None and len(arrsql)>0:
totalnum = len(arrsql)
if totalnum%sqlnum == 0:
foocount = totalnum/sqlnum
else:
foocount = totalnum/sqlnum+1
i = 0
while i<foocount:
arr = arrsql[i*sqlnum:(i+1)*sqlnum]
dboperater.execute(sqltext,args=arr,mode=mode,many=True)#执行SQL语句
dboperater.conn.commit() #提交SQL语句
i+=1
else:
# 执行单条sql语句
dboperater.execute(sqltext,mode=mode)
dboperater.conn.commit()
except MySQLdb.Error,e:
PLOG.debug("Mysql Error %d: %s,sql=%s" %(e.args[0], e.args[1],sqltext))
示例15: addJsonInfo
# 需要导入模块: from pysmartac.log import PLOG [as 别名]
# 或者: from pysmartac.log.PLOG import debug [as 别名]
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))