本文整理汇总了Python中logger.LOGGER.info方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.info方法的具体用法?Python LOGGER.info怎么用?Python LOGGER.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger.LOGGER
的用法示例。
在下文中一共展示了LOGGER.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gimmeTrame
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def gimmeTrame(self,daNewState):
"""
Return the update trame to be sent
"""
if (str(daNewState)=="toggle"):
if self.current_state=="off":
#on met à on
rawTrame="A55A6B0570000000"+ "FF9F1E0"+"7" +"30"
self.current_state="on"
elif(self.current_state=="on"):
#on met à off
rawTrame="A55A6B0550000000"+ "FF9F1E0"+"7" +"30"
self.current_state="off"
else:
rawTrame="A55A6B0550000000"+ "FF9F1E0"+"7" +"30"
self.current_state="off"
else:
LOGGER.warn("Strange new state : {}. Trram not send".format(daNewState))
return ""
LOGGER.info("State after : {}".format(self.current_state))
myTrame=Trame.trame(rawTrame)
myTrame.calculateChecksum()
LOGGER.info("Actuator trame generated, to be send : {}".format(myTrame.lessRawView()))
self.save()
return myTrame.rawView()
示例2: log_request
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def log_request(record):
global hpclient
req = json.dumps(record)
LOGGER.info(req)
if hpclient and record['is_shellshock']:
hpclient.publish(app.config['hpfeeds.channel'], req)
示例3: checkTrame
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def checkTrame(self):
if self.trameUsed:
LOGGER.debug("Trame received : {}".format(self.trameUsed.lessRawView()))
if ("A55A" not in self.trameUsed.sep):
LOGGER.warn("Wrong separator, rejected")
if (self.doChecksum(self.trameUsed) not in self.trameUsed.checkSum):
#Mauvais checkSum
LOGGER.warn("Wrong checksum, expected : {}, rejected".format(self.doChecksum(self.trameUsed)))
with self.lock:
if (self.trameUsed.ident in self.identSet):
#Recuperer le capteur en bdd
sensorUsed = sensor.Sensor.objects(physic_id=self.trameUsed.ident)[0]
newData = '' #la nouvelle data a entrer en base, type dynamique
if (sensorUsed.__class__.__name__=="Switch"):
newData=sensorUsed.translateTrame(self.trameUsed)
elif (sensorUsed.__class__.__name__=="Temperature"):
newData = sensorUsed.translateTrame(self.trameUsed)
elif (sensorUsed.__class__.__name__=="Position"):
newData = sensorUsed.translateTrame(self.trameUsed)
else :
LOGGER.warn("Other Captor (not handle (YET !) )")
# Update de la trame au niveau de la base
if newData :
sensorUsed.update(newData)
LOGGER.info(" Sensor {} ||New data {}".format(sensorUsed.physic_id, sensorUsed.current_state))
self.trameUsed=''
示例4: log_request
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def log_request(record):
global hpclient
req = json.dumps(record)
LOGGER.info(req)
if hpclient and (record['is_shellshock'] or app.config['hpfeeds.only_exploits'].lower() == 'false'):
hpclient.publish(app.config['hpfeeds.channel'], req)
示例5: translateTrame
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def translateTrame(self,inTrame):
"""
return the temperature (range 0-40 c) from data byte 2
"""
rowTemp=int(inTrame.data1,16)
temperature = round((rowTemp*40/255.0),3)
LOGGER.info("Temperature sensor {} with temp {}".format(inTrame.ident, temperature))
return temperature
示例6: sendTrame
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def sendTrame(self,ident,newState):
"""
Ask the traductor to send a trame with the new state of a captor
"""
LOGGER.info("Lazily updating {} with {}".format(ident,newState))
self.idToUpdate=ident
self.newState=newState
self.save()
示例7: sendTrame
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def sendTrame(self,ident,newState):
with self.lock:
sensorUsed=sensor.Device.objects(physic_id=ident)[0]
daTrame=sensorUsed.gimmeTrame(newState)
if daTrame:
self.soc.send(daTrame)
LOGGER.info("Trame sended : {}".format(daTrame))
return
示例8: updateOne
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def updateOne(self,ident):
"""
Ask for update the sensor with this id
"""
LOGGER.info("lazily updating {}".format(ident))
self.idToUpdate=ident
self.newState=''
self.save()
示例9: web_request
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def web_request(program, url):
LOGGER.info('Performing {} request on {}'.format(program, url))
data = ''
try:
resp = requests.get(url, headers={'User-Agent': USER_AGENTS[program]})
data = resp.text
except Exception as e:
LOGGER.error(e)
return '{} {}'.format(program, url), data
示例10: _import_listener
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def _import_listener(self, name, args):
listener, source = utils.import_(name, 'listener')
if not inspect.ismodule(listener):
listener = listener(*args)
elif args:
raise DataError("Listeners implemented as modules do not take arguments")
LOGGER.info("Imported listener '%s' with arguments %s (source %s)"
% (name, utils.seq2str2(args), source))
return listener
示例11: get_page
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def get_page(self):
if self.page is None:
LOGGER.info('Fetching page contents from Confluence')
data = self.server.getPage(
self.get_token(),
self.settings.namespace,
self.settings.pagename
)
self.page = ConfluencePage(data)
return self.page
示例12: call_method
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def call_method(self, method, *args):
if self.is_java:
args = [self._to_map(a) if isinstance(a, dict) else a for a in args]
try:
method(*args)
except:
message, details = utils.get_error_details()
LOGGER.error("Calling listener method '%s' of listener '%s' failed: %s"
% (method.__name__, self.name, message))
LOGGER.info("Details:\n%s" % details)
示例13: _email_config
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def _email_config(self):
try:
self.mail_server = smtplib.SMTP('smtp.gmail.com', 587)
self.mail_server.ehlo()
self.mail_server.starttls()
self.mail_server.login(self.gmail_user, self.gmail_password)
except Exception as e:
LOGGER.info("Failed to connnect. Error: {}".format(e))
exit()
示例14: DebugFile
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def DebugFile(path):
if path == 'NONE':
LOGGER.info('No debug file')
return None
try:
LOGGER.info('Debug file: %s' % path)
return _DebugFileWriter(path)
except:
LOGGER.error("Opening debug file '%s' failed and writing to debug file "
"is disabled. Error: %s" % (path, utils.get_error_message()))
return None
示例15: _import_listeners
# 需要导入模块: from logger import LOGGER [as 别名]
# 或者: from logger.LOGGER import info [as 别名]
def _import_listeners(self, listener_data):
listeners = []
for name, args in listener_data:
try:
listeners.append(_ListenerProxy(name, args))
except:
message, details = utils.get_error_details()
if args:
name += ':' + ':'.join(args)
LOGGER.error("Taking listener '%s' into use failed: %s"
% (name, message))
LOGGER.info("Details:\n%s" % details)
return listeners