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


Python LogFile.fromFullPath方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
    def __init__(self, nick, server, channel, port, loggingfile=None):
        self.server = server
        self.port = port

        if loggingfile is not None:
            log.startLogging(LogFile.fromFullPath(loggingfile))
        self.factory = ConversationBotFactory(self, ConversationBotClient,
                                              nick,
                                              channel)
开发者ID:trew,项目名称:conversationbot,代码行数:11,代码来源:ConversationBot.py

示例2: __init__

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def __init__(
         self, worker_id, path, rotateLength, maxRotatedFiles):
     self.worker_id = worker_id
     self.path = path
     self.rotateLength = rotateLength
     self.maxRotatedFiles = maxRotatedFiles
     self.closed_count = 0
     self.logfile = LogFile.fromFullPath(
         path, rotateLength=rotateLength, maxRotatedFiles=maxRotatedFiles)
开发者ID:BantouTelecom,项目名称:junebug,代码行数:11,代码来源:helpers.py

示例3: _openLogFile

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def _openLogFile(self, path):
     try:
         from twisted.python.logfile import LogFile
         log.msg("Setting up http.log rotating %s files of %s bytes each" %
                 (maxRotatedFiles, rotateLength))
         if hasattr(LogFile, "fromFullPath"):  # not present in Twisted-2.5.0
             return LogFile.fromFullPath(path, rotateLength=rotateLength, maxRotatedFiles=maxRotatedFiles)
         else:
             log.msg("WebStatus: rotated http logs are not supported on this version of Twisted")
     except ImportError, e:
         log.msg("WebStatus: Unable to set up rotating http.log: %s" % e)
开发者ID:bshawk,项目名称:buildbot,代码行数:13,代码来源:service.py

示例4: startService

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def startService(self):
     Service.startService(self)
     if self.filename != '-':
         self.logfile = LogFile.fromFullPath(
             self.filename, rotateLength=None, defaultMode=0o644)
         self.__previous_signal_handler = signal.signal(
             signal.SIGUSR1, self._signal_handler)
     else:
         self.logfile = sys.stdout
     self.observer = FileLogObserver(self.logfile)
     self.observer.start()
开发者ID:CanonicalLtd,项目名称:txlongpoll,代码行数:13,代码来源:services.py

示例5: __init__

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def __init__(self, logfilename):
     if logfilename is None:
         logFile = sys.stdout
     else:
         logFile = LogFile.fromFullPath(logfilename, rotateLength=None)
         # Override if signal is set to None or SIG_DFL (0)
         if not signal.getsignal(signal.SIGUSR1):
             def signalHandler(signal, frame):
                 from twisted.internet import reactor
                 reactor.callFromThread(logFile.reopen)
             signal.signal(signal.SIGUSR1, signalHandler)
     self.observer = log.FileLogObserver(logFile)
开发者ID:arjan,项目名称:sparked,代码行数:14,代码来源:tap.py

示例6: setup_logging

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
def setup_logging():
    filename = LOG_SETTINGS['file_path']
    log_file = LogFile.fromFullPath(
        filename,
        rotateLength=LOG_SETTINGS['max_bytes'],
        maxRotatedFiles=LOG_SETTINGS['max_backups']
    ) if filename is not None else sys.stdout

    log_level = getattr(logging, LOG_SETTINGS['level'])

    observer = LevelFileLogObserver(log_file, log_level)
    observer.timeFormat = LOG_SETTINGS['time_format']
    observer.start()
开发者ID:IL2HorusTeam,项目名称:minic,代码行数:15,代码来源:application.py

示例7: setServiceParent

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
    def setServiceParent(self, app):
        MultiService.setServiceParent(self, app)

        if config.ErrorLogEnabled:
            errorLogFile = LogFile.fromFullPath(
                config.ErrorLogFile,
                rotateLength=config.ErrorLogRotateMB * 1024 * 1024,
                maxRotatedFiles=config.ErrorLogMaxRotatedFiles
            )
            errorLogObserver = FileLogObserver(errorLogFile).emit

            # Registering ILogObserver with the Application object
            # gets our observer picked up within AppLogger.start( )
            app.setComponent(ILogObserver, errorLogObserver)
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:16,代码来源:caldav.py

示例8: opt_logfile

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def opt_logfile(self, logfile_path):
     """
     Log to a file. Log is written to ``stdout`` by default. The logfile
     directory is created if it does not already exist.
     """
     logfile = FilePath(logfile_path)
     logfile_directory = logfile.parent()
     if not logfile_directory.exists():
         logfile_directory.makedirs()
     self['logfile'] = LogFile.fromFullPath(
         logfile.path,
         rotateLength=LOGFILE_LENGTH,
         maxRotatedFiles=LOGFILE_COUNT,
     )
开发者ID:Azulinho,项目名称:flocker,代码行数:16,代码来源:script.py

示例9: makeService

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

    # install simple, blocking DNS resolver.
    from twisted.internet import reactor
    from twisted.internet.base import BlockingResolver
    reactor.installResolver(BlockingResolver())

    try:
        # Create dbus mainloop
        import dbus.mainloop.glib
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    except ImportError:
        warnings.warn('Failed to import the dbus module, some functionality might not work.')

    # Check if it is the right thing
    if not hasattr(config.module, 'Application'):
        raise usage.UsageError("Invalid application module: " + config.appName)

    # Instantiate the main application
    s = config.module.Application(config.appName, config.opts, config.appOpts)

    # Set quitflag
    s.quitFlag = launcher.QuitFlag(s.path("temp").child("quitflag"))

    # Set the name
    s.setName(config.appName)

    # make sure the relevant paths exist
    for kind in ["temp", "db"]:
        path = s.path(kind)
        if not path.exists():
            path.createDirectory()

    # Set up logging
    logFile = s.path("logfile")
    if not logFile.parent().exists():
        logFile.parent().createDirectory()
    filename = s.path("logfile").path

    if config.opts['no-logrotate']:
        observer = RotatableFileLogObserver(filename)
    else:
        logFile = LogFile.fromFullPath(filename, maxRotatedFiles=9)
        observer = log.FileLogObserver(logFile).emit
    log.addObserver(observer)

    return s
开发者ID:arjan,项目名称:sparked,代码行数:49,代码来源:tap.py

示例10: postOptions

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def postOptions(self):
     if self["journald"]:
         destination = JournaldDestination()
     else:
         if self["logfile"] is None:
             logfile = self._sys_module.stdout
         else:
             logfilepath = FilePath(self["logfile"])
             logfilepath_directory = logfilepath.parent()
             if not logfilepath_directory.exists():
                 logfilepath_directory.makedirs()
             # A twisted.python.logfile which has write and flush methods
             # but which also rotates the log file.
             logfile = LogFile.fromFullPath(
                 logfilepath.path, rotateLength=LOGFILE_LENGTH, maxRotatedFiles=LOGFILE_COUNT
             )
         destination = FileDestination(file=logfile)
     self.eliot_destination = destination
     original_postOptions(self)
开发者ID:Kaffa-MY,项目名称:flocker,代码行数:21,代码来源:script.py

示例11: getattr

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
from twisted.application import service
from twisted.python.log import ILogObserver
from twisted.python.logfile import LogFile

from tx_logging.observers import LevelFileLogObserver

from commander.service import RootService
from commander.settings import COMMANDER_LOG as LOG_SETTINGS


# Init logging ----------------------------------------------------------------
filename = LOG_SETTINGS['filename']
log_file = LogFile.fromFullPath(
    filename,
    rotateLength=LOG_SETTINGS['maxBytes'],
    maxRotatedFiles=LOG_SETTINGS['backupCount']
) if filename is not None else sys.stdout

log_level = getattr(logging, LOG_SETTINGS['level'])

observer = LevelFileLogObserver(log_file, log_level)
observer.timeFormat = LOG_SETTINGS['timeFormat']


# Init application ------------------------------------------------------------
application = service.Application("IL-2 Events Commander")
application.setComponent(ILogObserver, observer.emit)


# Init commander service ------------------------------------------------------
开发者ID:IL2HorusTeam,项目名称:il2ds-events-commander,代码行数:32,代码来源:application.py

示例12: _openLogFile

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def _openLogFile(self, path):
     self._nativeize = True
     return LogFile.fromFullPath(
         path, rotateLength=self.rotateLength, maxRotatedFiles=self.maxRotatedFiles)
开发者ID:s0undt3ch,项目名称:buildbot,代码行数:6,代码来源:service.py

示例13: FileLogObserver

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
from twisted.protocols.amp import AMP, Command, Integer, String
from twisted.python.usage import Options, UsageError
from twisted.internet import reactor, task, utils
from twisted.internet.protocol import ServerFactory
import sys,re
from twisted.application import service, internet
from simplebb.server import main

rotateLength = 1000000
maxRotatedFiles = 5

from twisted.python.logfile import LogFile
from twisted.python.log import ILogObserver, FileLogObserver

application = service.Application("My app")
logfile = LogFile.fromFullPath("server.log", rotateLength=rotateLength,
                                 maxRotatedFiles=maxRotatedFiles)
application.setComponent(ILogObserver, FileLogObserver(logfile).emit)



service.IProcess(application).processName = "simplebbsd"
s = main(use_tac=True)
s.setServiceParent(application)
开发者ID:hagna,项目名称:simplebb,代码行数:26,代码来源:masterd_tac.py

示例14:

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
from twisted.python import log
from twisted.web import static, server
from twisted.web.resource import Resource
from twisted.python.logfile import LogFile


try:
    from autobahn.wamp import WampServerFactory
except ImportError:  # autobahn 0.8.0+
    from autobahn.wamp1.protocol import WampServerFactory


sys.path.append("/etc/yadtbroadcast-server")
from broadcastserverconfig import LOG_FILE, CACHE_FILE, WS_PORT, DOCROOT_DIR, HTTP_PORT

log.startLogging(LogFile.fromFullPath(LOG_FILE))

import yadtbroadcastserver

try:
    os.makedirs(os.path.dirname(CACHE_FILE))
except exceptions.OSError, e:
    if e.errno != 17:
        log.err()
try:
    os.makedirs(os.path.dirname(LOG_FILE))
except exceptions.OSError, e:
    if e.errno != 17:
        log.err()

# TODO refactor: use util method in ws lib for url creation
开发者ID:yadt,项目名称:yadtbroadcast-server,代码行数:33,代码来源:yadtbroadcast-server.py

示例15: initialize_twisted_logging

# 需要导入模块: from twisted.python.logfile import LogFile [as 别名]
# 或者: from twisted.python.logfile.LogFile import fromFullPath [as 别名]
 def initialize_twisted_logging(self):
     twenty_megabytes = 20000000
     log_file = LogFile.fromFullPath(self.configuration['log_filename'],
                                     maxRotatedFiles=10,
                                     rotateLength=twenty_megabytes)
     log.startLogging(log_file)
开发者ID:andante-project,项目名称:yadtreceiver,代码行数:8,代码来源:__init__.py


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