Sophie

Sophie

distrib > Mageia > 6 > x86_64 > by-pkgid > 09408f3c1571cbb746da49a1d2f22702 > files > 2789

python-twisted-17.5.0-1.mga6.x86_64.rpm


# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.


"""
An example of using the rotating log.
"""

from twisted.python import log
from twisted.python import logfile

# rotate every 100 bytes
f = logfile.LogFile("test.log", "/tmp", rotateLength=100)

# setup logging to use our new logfile
log.startLogging(f)

# print a few message
for i in range(10):
    log.msg("this is a test of the logfile: %s" % i)

# rotate the logfile manually
f.rotate()

log.msg("goodbye")