當前位置: 首頁>>代碼示例>>Python>>正文


Python Logger.Logger方法代碼示例

本文整理匯總了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() 
開發者ID:schutzwerk,項目名稱:CANalyzat0r,代碼行數:25,代碼來源:SnifferProcess.py

示例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) 
開發者ID:Percona-Lab,項目名稱:mongodb_consistent_backup,代碼行數:9,代碼來源:Main.py

示例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 
開發者ID:ericjang,項目名稱:cryptocurrency_arbitrage,代碼行數:17,代碼來源:Bot.py

示例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() 
開發者ID:rapid7,項目名稱:myBFF,代碼行數:16,代碼來源:framework.py

示例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 
開發者ID:PanDAWMS,項目名稱:pilot,代碼行數:38,代碼來源:pUtil.py

示例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() 
開發者ID:schutzwerk,項目名稱:CANalyzat0r,代碼行數:12,代碼來源:SenderThread.py

示例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
        } 
開發者ID:listen-now,項目名稱:listen-now,代碼行數:12,代碼來源:music.py

示例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 
開發者ID:PanDAWMS,項目名稱:pilot,代碼行數:45,代碼來源:HPCManager.py

示例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() 
開發者ID:schutzwerk,項目名稱:CANalyzat0r,代碼行數:61,代碼來源:AbstractTab.py

示例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()) 
開發者ID:johngrantuk,項目名稱:piupdue,代碼行數:52,代碼來源:piupdue.py


注:本文中的Logger.Logger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。