当前位置: 首页>>代码示例>>Python>>正文


Python Log.getDefaultLog方法代码示例

本文整理汇总了Python中lsst.pex.logging.Log.getDefaultLog方法的典型用法代码示例。如果您正苦于以下问题:Python Log.getDefaultLog方法的具体用法?Python Log.getDefaultLog怎么用?Python Log.getDefaultLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lsst.pex.logging.Log的用法示例。


在下文中一共展示了Log.getDefaultLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
def main():
    """execute the watchLogs script"""

    try:
        (cl.opts, cl.args) = cl.parse_args()
        Log.getDefaultLog().setThreshold(
            run.verbosity2threshold(cl.opts.verbosity, 0))
        if cl.opts.inclhosts:
            cl.opts.inclhosts = cl.opts.inclhosts.split(',')
        if cl.opts.exclhosts:
            cl.opts.exclhosts = cl.opts.exclhosts.split(',')
        hosts = cl.opts.inclhosts
        if not hosts:
            hosts = cl.opts.exclhosts

        if cl.opts.minimport and cl.opts.maximport and \
           cl.opts.minimport > cl.opts.maximport:
            raise run.UsageError(
                "-m value (%i) should be less than -M value (%i)" %
                (cl.opts.minimport, cl.opts.maximport))

        watchLogs(cl.args[0], cl.args[1:], cl.opts.sleep,
                  cl.opts.slice, hosts, not bool(cl.opts.inclhosts),
                  cl.opts.minimport, cl.opts.maximport)

    except run.UsageError, e:
        print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
        sys.exit(1)
开发者ID:jonathansick-shadow,项目名称:ctrl_dc3pipe,代码行数:30,代码来源:watchLogs.py

示例2: main

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
def main():
    "execute the launchMospipe script"

    logger = Log(Log.getDefaultLog(), "launchMos")
    try:
        (cl.opts, cl.args) = cl.parse_args()
        Log.getDefaultLog().setThreshold(-10 * cl.opts.verbosity)

        if cl.opts.pipeverb is None:
            cl.opts.pipeverb = "trace"

        t = filter(lambda x: x.startswith(cl.opts.datatype.lower()),
                   datatypes.keys())
        if len(t) > 1:
            raise ValueError("Ambiguous data type name: " + cl.opts.datatype)
        if len(t) == 0:
            raise ValueError("Unrecognized data type name: "+ cl.opts.datatype)
        cl.opts.datatype = datatypes[t[0]]

        colls = []
        # parse the collection names
        if cl.opts.colls is not None:
            colls = cl.opts.colls.split(',')

        launchMos(cl.args[0], cl.args[1], cl.args[2:], colls, cl.opts, logger)
        
    except run.UsageError, e:
        print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
        sys.exit(1)
开发者ID:jonathansick-shadow,项目名称:ctrl_mospipe,代码行数:31,代码来源:launchMospipe.py

示例3: showAllLogProperties

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def showAllLogProperties(self, show):
     """control whether log properties are displayed to the screen.  These
     include, for example, the DATE (and time) of the message.
     @param show   if true, show all the properties when a log message is
                      printed.  If false, don't show them.
     """
     Log.getDefaultLog().setShowAll(show)
开发者ID:lsst-dm,项目名称:legacy-pex_harness,代码行数:9,代码来源:simpleStageTester.py

示例4: testEventLogger

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
def testEventLogger(broker, runid, sliceid, props, input=None, logname=None,
                    logtopic="LSSTLogging"):
    """
    test logging through a broker.  This will send a single message to a 
    the logger, and, if input is a list of string or and file input object,
    it will also send all input message in order.  If broker is None, the
    log messages will not got to any event broker, only to the screen.
    @param broker  the host running the event broker
    @param runid   the runid to assume for the log (ignored if broker is None)
    @param sliceid the sliceid to assume for the log (ignored if broker is None)
    @param props   a set of properties to attach to all messages
    @param input   if not None, messages to send, either in the form of
                      of a list of strings or a file object to read from
    @param logname the log name to send messages to 
    @param logtopic   the event topic to use (def: "LSSTLogging")
    """
    if broker:
        thresh = Log.getDefaultLog().getThreshold()
        setEventLogger(broker, runid, sliceid, thresh <= Log.DEBUG, logtopic)
        Log.getDefaultLog().setThreshold(thresh)
        logger.log(VERB, "Created event logger")
    else:
        logger.log(VERB, "Messages only going to screen")
        logger.setShowAll(Log.getDefaultLog().getThreshold() <= Log.DEBUG)

    if logname is None:
        logname = "showEvents"
    uselog = Log(Log.getDefaultLog(), logname)

    for key in props.keys():
        uselog.addPreamblePropertyString(key, props[key])

    testLogger(uselog, input)
开发者ID:jonathansick-shadow,项目名称:ctrl_dc3pipe,代码行数:35,代码来源:testEventLogger.py

示例5: main

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
def main():
    """execute the testEventLogger script"""

    try:
        (cl.opts, cl.args) = cl.parse_args()
        Log.getDefaultLog().setThreshold(
            run.verbosity2threshold(cl.opts.verbosity, 0))

        props = {}
        if cl.opts.stage:
            props["stageId"] = cl.opts.stage
        if cl.opts.pipeline:
            props["pipeline"] = cl.opts.pipeline

        broker = None
        if len(cl.args) > 0:
            broker = cl.args[0]
        input = None
        if cl.opts.stdin:
            input = sys.stdin

        testEventLogger(broker, cl.opts.runid, cl.opts.slice, props, 
                        input, cl.opts.logname, cl.opts.logtopic)
    except run.UsageError, e:
        print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
        sys.exit(1)
开发者ID:jonathansick-shadow,项目名称:ctrl_dc3pipe,代码行数:28,代码来源:testEventLogger.py

示例6: run

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
def run():
    Log.getDefaultLog()
    memId0 = dafBase.Citizen_getNextMemId()
    main()
    # check for memory leaks
    if dafBase.Citizen_census(0, memId0) != 0:
        print dafBase.Citizen_census(0, memId0), 'Objects leaked:'
        print dafBase.Citizen_census(dafBase.cout, memId0)
开发者ID:Daraexus,项目名称:ip_diffim,代码行数:10,代码来源:runWarpExposure.py

示例7: setDebugVerbosity

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def setDebugVerbosity(self, verbLimit):
     """set the verbosity of the default log.  This and setLogThreshold()
     are different APIs that affect the same underlying limit that controls
     how many messages get logged.
     @param verbLimit    debug messages with a verbosity level larger
                            than this will not be printed.  If positive
                            INFO, WARN, and FATAL messages will also
                            be printed.  
     """
     Log.getDefaultLog().setThreshold(-1*verbLimit)
开发者ID:lsst-dm,项目名称:legacy-pex_harness,代码行数:12,代码来源:simpleStageTester.py

示例8: setLogThreshold

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def setLogThreshold(self, threshold):
     """set the importance threshold for the default log.  This and
     setDebugVerbosity are different APIs that affect the same underlying
     limit that controls how many messages get logged.  Normally one
     uses one of the predefined values--Log.DEBUG, Log.INFO, Log.WARN, and
     Log.FATAL--as input.
     @param threshold    the minimum importance of the message that will
                            get printed.
     """
     Log.getDefaultLog().setThreshold(threshold)
开发者ID:lsst-dm,项目名称:legacy-pex_harness,代码行数:12,代码来源:simpleStageTester.py

示例9: setLogThreshold

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def setLogThreshold(self, level):
     """
     set the default message importance threshold to be used for 
     recording messages.  This will value be applied to the default
     root (system-wide) logger (or what it will be after logging is 
     initialized) so that all software components are affected.
     """
     if self.log is not None:
         Log.getDefaultLog().setThreshold(level)
         self.log.log(Log.INFO, 
                      "Upating Root Log Message Threshold to %i" % level)
     self.logthresh = level
开发者ID:lsst-dm,项目名称:legacy-pex_harness,代码行数:14,代码来源:Pipeline.py

示例10: main

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
def main():
    """execute the showEvents script"""

    try:
        (cl.opts, cl.args) = cl.parse_args()
        Log.getDefaultLog().setThreshold(
            run.verbosity2threshold(cl.opts.verbosity, 0))

        showEvents(cl.args[0], cl.args[1:], cl.opts.sleep)

    except run.UsageError, e:
        print >> sys.stderr, "%s: %s" % (cl.get_prog_name(), e)
        sys.exit(1)
开发者ID:jonathansick-shadow,项目名称:ctrl_dc3pipe,代码行数:15,代码来源:showEvents.py

示例11: __init__

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def __init__(self, policy, log=None, stageId=-1, eventBroker=None,
              sysdata=None):
     """
     initialize this stage with the policy that defines the stage and
     some contextual system data.  Applications normally do not directly
     call this constructor.  Instead they either construct a Stage subclass
     or create a Stage instance using makeStage() or makeStageFromPolicy().
     
     @param policy       the policy that will configure the SerialProcessing
                            and ParallelProcessing
     @param log          the log object the stage instance should 
                           should use.  If not provided, a default will be
                           used.
     @param eventBroker  the name of the host where the event broker is
                           running.  If not provided, an eventBroker will
                           not be available to the stage.
     @param sysdata      a dictionary of data describing the execution
                           context.  The stage uses this information to
                           set some of its internal data.  See
                           StageProcessing documentation for datails.
                           The name provided in the policy will override
                           the name in this dictionary
     """
     if sysdata is None:
         sysdata = {}
     self.sysdata = sysdata
     self.stagePolicy = policy
     self.eventBroker = eventBroker
     if log is None:
         log = Log(Log.getDefaultLog(), "stage")
     self.log = log
开发者ID:lsst-dm,项目名称:legacy-pex_harness,代码行数:33,代码来源:stage.py

示例12: __init__

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
    def __init__(self, persistDir, logger=None, runId=None,
                 fromSubclass=False):
        """
        create the JobOffice
        @param persistDir   the directory where the blackboard should be
                              persisted
        @param logger       the logger to use.  If not given, the default
                              will be used.
        @param runId        the run ID to restrict our attention to.  If
                              not None, incoming events will be restricted
                              to the given runId.
        """
        self._checkAbstract(fromSubclass, "JobOffice")
        threading.Thread.__init__(self, name="JobOffice")
        self.setDaemon(False)

        self.bb = Blackboard(persistDir)
        self.esys = EventSystem.getDefaultEventSystem()
        self.runId = runId
        self.brokerHost = None
        self.brokerPort = None
        self.originatorId = self.esys.createOriginatorId()

        if logger is None:
            logger = Log.getDefaultLog()
        self.log = logger   # override this in sub-class

        self.halt = False
        self.finalDatasetSent = False
        self.jobOfficeCompletedSent = False
        self.stopTopic = "JobOfficeStop"
        self.stopThread = None
        self.exc = None
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:35,代码来源:jobOffice.py

示例13: __init__

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
    def __init__(self, persistDir, logger=None, lock=SharedData()):
        """
        create an empty blackboard
        @param persistDir  a path to a directory where the blackboard's
                             state can persisted.
        @param logger      the logger to gather error messages
        @param lock        a SharedData instance to be used to protect this
                             instance from simultaneous updates by different
                             threads.  If not provided, a default is used.
        """
        LockProtected.__init__(self, lock)

        # the encompassing persistence directory
        self._persistDir = persistDir
        
        parent = os.path.dirname(self._persistDir)
        if not os.path.isdir(parent) or not os.path.exists(parent):
            raise BlackboardPersistError("Unable to create queue directory: %s: directory not found" % parent)
        if not os.path.exists(self._persistDir):
            os.mkdir(self._persistDir)
        elif not os.path.isdir(self._persistDir):
            raise BlackboardAccessError("Queue directory: %s: not a directory"
                                        % self._persistDir)

        # the logger to use
        if not logger:
            logger = Log.getDefaultLog()
        self._log = Log(logger, "blackboard")

        # prep the queues
        self.queues = lock
        with self.queues:
        
            # a queue representing available datasets to be processed.
            dir = os.path.join(self._persistDir, "dataAvailable")
            self.queues.dataAvailable = DataQueue(dir, self._log, lock)

            # a queue of datasets that have beend bundled into jobs and queued
            # for processing.  
            dir = os.path.join(self._persistDir, "jobsPossible")
            self.queues.jobsPossible = JobQueue(dir, self._log, lock)

            # a queue of jobs that are ready to be processed
            dir = os.path.join(self._persistDir, "jobsAvailable")
            self.queues.jobsAvailable = JobQueue(dir, self._log, lock)

            # a queue of jobs that have been taken up by a pipeline and are
            # currently being processed.
            dir = os.path.join(self._persistDir, "jobsInProgress")
            self.queues.jobsInProgress = JobQueue(dir, self._log, lock)

            # a queue for jobs that have been completed by a pipeline
            dir = os.path.join(self._persistDir, "jobsDone")
            self.queues.jobsDone = JobQueue(dir, self._log, lock)

            # a queue of pipelines that are ready to accept a job
            dir = os.path.join(self._persistDir, "pipelinesReady")
            self.queues.pipelinesReady = JobQueue(dir, self._log, lock)

        self._dbfail = 0
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:62,代码来源:Blackboard.py

示例14: setup

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def setup(self):
     if not self.log:
         self.log = Log.getDefaultLog()
     self.mylog = Log(self.log, "output")
     self.outputDatasetsKey = \
                 self.policy.getString("inputKeys.outputDatasets")
     self.possibleDatasetsKey = \
                 self.policy.getString("inputKeys.possibleDatasets")
开发者ID:jonathansick-shadow,项目名称:ctrl_sched,代码行数:10,代码来源:fillerStages.py

示例15: __init__

# 需要导入模块: from lsst.pex.logging import Log [as 别名]
# 或者: from lsst.pex.logging.Log import getDefaultLog [as 别名]
 def __init__(self, stageId=-1, policy=None):
     """
     Standard Stage initializer.
     """
     lsst.pex.harness.Stage.Stage.__init__(self, stageId, policy)
     self.mopsLog = Log(Log.getDefaultLog(), 'mops.stage')
     if isinstance(self.mopsLog, log.ScreenLog):
         self.mopsLog.setScreenVerbose(True)
     return
开发者ID:jonathansick-shadow,项目名称:mops_nightmops,代码行数:11,代码来源:pipeline.py


注:本文中的lsst.pex.logging.Log.getDefaultLog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。