本文整理汇总了Python中Logger.Logger方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.Logger方法的具体用法?Python Logger.Logger怎么用?Python Logger.Logger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger.Logger方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def __init__(self,
snifferSendPipe,
sharedEnabledFlag,
snifferName,
CANData=None):
"""
Set the passed parameters.
:param snifferSendPipe: The multiprocessing pipe to send received data to
:param sharedEnabledFlag: The multiprocessing value to handle disabling
:param snifferName: The name of the sniffer process, used for logging
:param CANData: Optional: The CANData instance to query for data.
If this is not specified, the global interface is being used
"""
Process.__init__(self)
self.CANData = CANData if CANData is not None else Globals.CANData
self.snifferSendPipe = snifferSendPipe
self.sharedEnabledFlag = sharedEnabledFlag
self.snifferName = snifferName
self.logger = Logger(Strings.snifferProcessLoggerName + " (" +
self.snifferName + ")").getLogger()
示例2: setup_logger
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def setup_logger(self):
try:
self.logger = Logger(self.config, self.backup_time)
self.logger.start()
self.logger.start_file_logger()
except Exception, e:
self.exception("Could not start logger: %s" % e, e)
示例3: __init__
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def __init__(self, config, brokers):
"""
config = configuration file
brokers = array of broker objects
"""
super(Bot, self).__init__()
self.config = config
self.brokers = brokers
self.error = False
self.log = Logger()
self.backtest_data = None
self.max_ticks = 0
self.data_path = abspath(config.TICK_DIR)
self.trading_enabled = True
self.tick_i = 0
示例4: run
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def run(self, argv):
self.parseParameters(argv)
if self.config["output"]:
writer = Logger(sys.stdout, self.config["output"])
sys.stdout = writer
self.banner(self)
if self.config["PASS_FILE"]:
acceptance = raw_input("""
[!] WARNING! BRUTE FORCE MODE ENABLED! THIS LIKELY WILL LOCK OUT ACCOUNTS! ARE YOU SURE YOU WANT TO RUN? (type Y to continue)
""")
if acceptance != 'Y':
print("[-] Exiting")
sys.exit()
self.runner()
示例5: tologNew
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def tologNew(msg, tofile=True, label='INFO', essential=False):
""" Write message to pilot log and to stdout """
# remove backquotes from the msg since they cause problems with batch submission of pilot
# (might be present in error messages from the OS)
msg = msg.replace("`","'")
msg = msg.replace('"','\\"')
import logging
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s\t%(process)d\t%(levelname)s\t%(message)s')
from Logger import Logger
if essential:
log = Logger(filename=essentialPilotlogFilename)
else:
log = Logger(filename=pilotlogFilename)
if tofile:
if label == 'INFO':
log.info(msg)
elif label == 'WARNING':
log.warning(msg)
elif label == 'DEBUG':
log.debug(msg)
elif label == 'ERROR':
log.error(msg)
elif label == 'CRITICAL':
log.critical(msg)
else:
log.warning('Unknown label: %s' % (label))
log.info(msg)
else:
print msg
# write any serious messages to stderr
if label == 'ERROR' or label == 'CRITICAL':
print >> sys.stderr, msg # write any FAILED messages to stderr
示例6: __init__
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def __init__(self, packets, sleepTime, CANData, threadName):
QtCore.QThread.__init__(self)
self.packets = packets
self.sleepTime = sleepTime
self.CANData = CANData
self.threadName = threadName
self.enabled = True
self.logger = Logger(Strings.senderThreadLoggerName + " (" +
self.threadName + ")").getLogger()
示例7: __init__
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def __init__(self):
"""
初始化日志记录方法
测试日志记录是否正常启用
"""
music_logger = Logger.Logger('music_all.log', 'debug')
music_logger.logger.debug('This is a test log.')
self.headers = {
'token': token_message
}
示例8: __init__
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def __init__(self, logFileName=None):
self.__globalWorkingDir = None
self.__localWorkingDir = None
self.__jobStateFile = 'HPCManagerState.json'
self.__logFileName = logFileName
self.__log= Logger(logFileName)
self.__isFinished = False
# HPC resource information
self.__queue = None
self.__backfill_queue = None
self.__nodes = None
self.__cpuPerNode = None
self.__ATHENA_PROC_NUMBER = None
self.__repo = None
self.__mppwidth = None
self.__mppnppn = None
self.__walltime = None
self.__walltime_m = 0
# Number of AthenaMP workers per rank
self.__ATHENA_PROC_NUMBER = 2
self.__eventsPerWorker = 3
self.__failedPollTimes = 0
self.__lastState = None
self.__lastTime = time.time()
self.__copyInputFiles = copyInputFiles
self.__mode = None
self.__jobs = {}
self.__jobsFile = None
self.__eventRanges = None
self.__eventRangesFile = None
self.__jobid = None
self.__stageout_threads = 1
self.__pandaJobStateFile = None
self.__pluginName = 'pbs'
self.__plugin = None
self.__localSetup = None
self.__firstJobWorkDir = None
示例9: __init__
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def __init__(self,
tabWidget,
loggerName,
readOnlyCols,
packetTableViewName,
labelInterfaceValueName=None,
CANData=None,
hideTimestampCol=True,
sendToSenderContextMenu=True,
saveAsPacketSetContextMenu=True,
allowTableCopy=True,
allowTablePaste=True,
allowTableDelete=True):
#: The specific GUI tab
self.tabWidget = tabWidget
#: Tab specific read only columns as list of indexes
self.readOnlyCols = readOnlyCols
# Whether we hide the timestamp column or not
self.hideTimestampCol = hideTimestampCol
#: Raw packet data that corresponds to the data displayed in the GUI table
self.rawData = []
#: Custom packet model of the GUI table
self.packetTableModel = None
#: The tab specific CANData instance
self.CANData = CANData
#: Whether the tab is currently active (using ``CANData``)
self.active = False
# Default indexes for GUI tables
self.IDColIndex = 0
self.dataColIndex = 1
self.lengthColIndex = 2
self.timestampColIndex = 3
self.descriptionColIndex = 4
# Context menu settings
self.sendToSenderContextMenu = sendToSenderContextMenu
self.saveAsPacketSetContextMenu = saveAsPacketSetContextMenu
# Shortcut settings
self.allowTableCopy = allowTableCopy
self.allowTablePaste = allowTablePaste
self.allowTableDelete = allowTableDelete
self.packetTableView = self.tabWidget.findChild(
QtGui.QTableView, packetTableViewName)
if labelInterfaceValueName is not None:
self.labelInterfaceValue = self.tabWidget.findChild(
QtGui.QLabel, labelInterfaceValueName)
assert (self.packetTableView
and self.labelInterfaceValue), "GUI elements not found"
else:
self.labelInterfaceValue = None
assert (self.packetTableView), "tableView not found"
#: The tab specific logger
self.loggerName = loggerName
self.logger = Logger(self.loggerName).getLogger()
示例10: Upload
# 需要导入模块: import Logger [as 别名]
# 或者: from Logger import Logger [as 别名]
def Upload(sketchFile, port, logFile=False, sockJs=False):
try:
global log
if not logFile:
log = Logger.Logger(False) # Doesn't save to Log, just prints.
else:
log = Logger.Logger(True, logFile, True, sockJs) # Saves to Log file.
log.Log("Starting ArduinoFlashLog.py")
log.Log(sketchFile)
log.Log(port)
Checks(port, sketchFile)
portDetail = []
GetPortInfo(port, portDetail) # Gets the details for the specified port.
#log.Log(str(portDetail))
#log.Log(portDetail[0][1])
if len(portDetail) < 1:
log.Log("Port not connected to a supported device.")
elif portDetail[0][1] == "Due-SAMBA Mode": # Checks if port is already in SAM-BA mode. If it is then Flash file.
log.Log("Already in SAM-BA Mode.")
ArduinoFlashLoad(sketchFile, port, ArduinoFlashHardValues.isNativePort)
elif portDetail[0][1] == "Due": # Checks if port is in Due mode. If so then set to SAM-BA then Flash file.
log.Log("Setting into SAM-BA Mode.")
SetSamBA(port) # Sets processor into SAM-BA mode.
time.sleep(2)
portList = GetConnectedDeviceList() # Gets list of all connected serials.
for port in portList: # Check each port for a connect SAM-BA mode and assume it is correct one.
log.Log("Port: " + str(port))
log.Log(str(port[1]))
if port[1] == "Due-SAMBA Mode":
log.Log("New port: " + port[0])
ArduinoFlashLoad(sketchFile, port[0], ArduinoFlashHardValues.isNativePort)
break
else:
log.Log("Not a supported device.")
if ser:
ser.close()
log.Log("Exiting ArduinoFlashLog.py")
except Exception, e:
log.Log("Main Exception:")
log.Log(traceback.format_exc())