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


Python DailyLogFile.fromFullPath方法代码示例

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


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

示例1: make_logfile_observer

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def make_logfile_observer(path, show_source=False):
    """
    Make an observer that writes out to C{path}.
    """
    from twisted.logger import FileLogObserver
    from twisted.python.logfile import DailyLogFile

    f = DailyLogFile.fromFullPath(path)

    def _render(event):

        if event.get("log_system", u"-") == u"-":
            logSystem = u"{:<10} {:>6}".format("Controller", os.getpid())
        else:
            logSystem = event["log_system"]

        if show_source and event.get("log_namespace") is not None:
            logSystem += " " + event.get("cb_namespace", event.get("log_namespace", ''))

        if event.get("log_format", None) is not None:
            eventText = formatEvent(event)
        else:
            eventText = ""

        if "log_failure" in event:
            # This is a traceback. Print it.
            eventText = eventText + event["log_failure"].getTraceback()

        eventString = NOCOLOUR_FORMAT.format(
            formatTime(event["log_time"]), logSystem, eventText) + os.linesep

        return eventString

    return FileLogObserver(f, _render)
开发者ID:yatskevich,项目名称:crossbar,代码行数:36,代码来源:_logging.py

示例2: run_normal

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
 def run_normal(self):
     if self.debug:
         log.startLogging(sys.stdout)
     else:
         log.startLogging(DailyLogFile.fromFullPath(self.logfile))
     log.msg("portal server listen %s" % self.portal_host)
     reactor.listenUDP(self.listen_port, self, interface=self.portal_host)
开发者ID:simudream,项目名称:toughportal,代码行数:9,代码来源:cmcc_server.py

示例3: makeService

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def makeService(_config):
    global config
    config = _config

    if config['logpath'] != None:
        logFilePath = os.path.abspath(config['logpath'])
        logFile = DailyLogFile.fromFullPath(logFilePath)
    else:
        logFile = sys.stdout

    log.startLogging(logFile)

    lumenService = service.MultiService()

    # Bayeux Service
    import bayeux
    bayeuxFactory = bayeux.BayeuxServerFactory()
    bayeuxService = internet.TCPServer(config['port'], bayeuxFactory)
    bayeuxService.setServiceParent(lumenService)

    # WebConsole Service
    import webconsole
    site = server.Site(webconsole.WebConsole())
    webConsoleService = internet.TCPServer(config['webport'], site)
    webConsoleService.setServiceParent(lumenService)

    application = service.Application("lumen")
    lumenService.setServiceParent(application)

    return lumenService
开发者ID:unsouled,项目名称:lumen,代码行数:32,代码来源:lumen.py

示例4: noiseControl

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def noiseControl(options):
    # terminal noise/info logic
    # allows the specification of the log file location
    if not options["loud"]:
        log_path = options["log"]
        log.startLogging(DailyLogFile.fromFullPath(log_path))
    return None
开发者ID:dmpayton,项目名称:hendrix,代码行数:9,代码来源:ux.py

示例5: _createLogFile

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
    def _createLogFile(self, uuid):
        logDirPath = '{cwd}\\..\\logs\\aiprocesses'.format(cwd=os.getcwd())
        if not os.path.exists(logDirPath):
            os.mkdir(logDirPath)

        logFilePath = '{dir}\\{uuid}.log'.format(dir=logDirPath, uuid=uuid)
        log.startLogging(DailyLogFile.fromFullPath(logFilePath))
开发者ID:FlorinLozneanu,项目名称:tictactoe,代码行数:9,代码来源:aiprocess.py

示例6: init_logging

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def init_logging(logdir, logname):
    if DEBUG_LEVEL > 0:
        log.startLogging(sys.stdout)
    if not os.path.exists(logdir):
        os.makedirs(logdir)
    logfile = get_path(os.path.join(logdir, logname))
    log.startLogging(DailyLogFile.fromFullPath(logfile))
开发者ID:hosle,项目名称:tapas,代码行数:9,代码来源:util.py

示例7: __init__

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
	def __init__(self):
		try:
			logfile = DailyLogFile.fromFullPath(cfg.logging.filename)
		except AssertionError:
			raise AssertionError("Assertion error attempting to open the log file: {0}. Does the directory exist?".format(cfg.logging.filename))

		twistedlogger.startLogging(logfile, setStdout=False)
开发者ID:Urthen,项目名称:Fritbot_Python,代码行数:9,代码来源:audit.py

示例8: logToDir

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def logToDir(directory='logs', LOG_TYPE=('console',), OBSERVER=MyLogObserver):
    """Call this to write logs to the specified directory,
       optionally override the FileLogObserver.
    """
    for name in LOG_TYPE:
        path = os.path.join(directory, name + '.log')
        logfile = DailyLogFile.fromFullPath(path)
        logs[name] = OBSERVER(logfile)
开发者ID:cbrinley,项目名称:droned,代码行数:10,代码来源:logging.py

示例9: start_logging

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def start_logging(opts):
    from twisted.python import log
    from twisted.python.logfile import DailyLogFile
    if opts.logfile:
        logfile = DailyLogFile.fromFullPath(opts.logfile)
    else:
        logfile = sys.stderr
    log.startLogging(logfile)
开发者ID:andresp99999,项目名称:splash,代码行数:10,代码来源:server.py

示例10: start_logging

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
 def start_logging(self):
     """Starts logging to log file or stdout depending on config."""
     if self.use_log:
         if self.log_stdout:
             log.startLogging(sys.stdout)
         else:
             log_file = os.path.expanduser(self.log_file)
             log.startLogging(DailyLogFile.fromFullPath(log_file))
开发者ID:maelick,项目名称:Clipsync,代码行数:10,代码来源:clipsync.py

示例11: _handle_logging

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
    def _handle_logging(self):
        """
        Start logging to file if there is some file configuration and we
        are not running in development mode
        """

        if self.development is False and self._log_file is not None:
            self.already_logging = True
            log.startLogging(DailyLogFile.fromFullPath(self.log_file))
开发者ID:DamnWidget,项目名称:mamba,代码行数:11,代码来源:app.py

示例12: start_logging

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def start_logging(opts):
    from twisted.python import log
    from twisted.python.logfile import DailyLogFile
    if opts.logfile:
        logfile = DailyLogFile.fromFullPath(opts.logfile)
    else:
        logfile = sys.stderr
    log.startLogging(logfile)
    log.msg("Open files limit: %d" % resource.getrlimit(resource.RLIMIT_NOFILE)[0])
开发者ID:netconstructor,项目名称:splash,代码行数:11,代码来源:server.py

示例13: init

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
    def init(cls, target='stdout', log_level=2, filename='twistd.log'):
        cls.filename = filename
        cls.target = target
        cls.log_level = log_level

        if cls.target is 'file':
            logfile = get_filename(filename=cls.filename)
            log.startLogging(DailyLogFile.fromFullPath(logfile))
        else:
            log.startLogging(stdout)
开发者ID:gitter-badger,项目名称:today-server,代码行数:12,代码来源:log.py

示例14: configure

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def configure(**options):
    global logLevel, logFile
    LEVELS = {
        'debug': logging.DEBUG,
        'info': logging.INFO,
        'warning': logging.WARNING,
        'error': logging.ERROR,
        'critical': logging.CRITICAL
    }

    logLevel = LEVELS[options.get('loglevel', 'info').lower()]
    logging.basicConfig(level=logLevel)

    logFile = options.get('logfile', None)
    if logFile:
        # defaultMode=0644 # workaround for https://twistedmatrix.com/trac/ticket/7026
        log.startLogging(DailyLogFile.fromFullPath(logFile,defaultMode=0644))
    else:
        log.startLogging(sys.stdout)
开发者ID:TigerND,项目名称:dtx-core,代码行数:21,代码来源:conf.py

示例15: main

# 需要导入模块: from twisted.python.logfile import DailyLogFile [as 别名]
# 或者: from twisted.python.logfile.DailyLogFile import fromFullPath [as 别名]
def main(options):

    connection = settings.REDIS_CLASS()

    log.startLogging(sys.stdout)
    log.startLogging(DailyLogFile.fromFullPath(os.path.join(settings.LOG_DIRECTORY, 'master.log')), setStdout=1)
    log.addObserver(RedisLogObserver(connection).emit)

    factory = TwitterJobTrackerFactory(connection, TwitterJob, settings.MAX_CLIENTS, options=options)
    reactor.listenTCP(settings.JT_PORT + options.ha, factory)
    reactor.run()
开发者ID:antiface,项目名称:twittomatic,代码行数:13,代码来源:master.py


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