本文整理汇总了Python中common.logger.Logger.infoLogging方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.infoLogging方法的具体用法?Python Logger.infoLogging怎么用?Python Logger.infoLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.logger.Logger
的用法示例。
在下文中一共展示了Logger.infoLogging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_analysis_task
# 需要导入模块: from common.logger import Logger [as 别名]
# 或者: from common.logger.Logger import infoLogging [as 别名]
def send_analysis_task(self, name, subject, hashtag, length, client_id, time, client_ip):
global console
logger = Logger()
cacert = None
server_certificate = None
server_key = None
taskid = uuid.uuid4()
try:
for cert in os.listdir(SERVER_CERTIFICATE):
if all(x in cert for x in ["pem", "server"]):
server_certificate = os.path.join(SERVER_CERTIFICATE, cert)
if "ca" in cert:
cacert = os.path.join(SERVER_CERTIFICATE, cert)
if "key" in cert:
server_key = os.path.join(SERVER_CERTIFICATE, cert)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl_sock = ssl.wrap_socket(
sock=sock, ca_certs=cacert, certfile=server_certificate, keyfile=server_key, cert_reqs=ssl.CERT_REQUIRED
)
analyzer = self.get_analyzer(name, client_id, time, client_ip, hashtag, taskid, length)
ssl_sock.connect((analyzer[1], ANALYZER_PORT))
console.put("Sending identity")
ssl_sock.send(str((taskid, name, "checksum", hashtag, length)))
data = ssl_sock.recv()
console.put(data)
if data == "ready":
ssl_sock.sendall(subject)
data = ssl_sock.recv()
console.put(data)
data = ssl_sock.recv()
console.put(data)
ssl_sock.close()
subjectinfo = "Subject:%s|Hashvalue:%s|Length:%s|Client:%s|Client IP:%s|Analyzer:%s|Analyzer IP:%s " % (
name,
hashtag,
length,
client_id,
client_ip,
analyzer[0],
analyzer[1],
)
logger.infoLogging(subjectinfo)
except Exception, e:
info = str(e)
console.put(info)
logger.errorLogging(info)