mercurial/loggingutil.py
changeset 40800 698477777883
parent 40799 03127e580980
child 40821 96be0ecad648
equal deleted inserted replaced
40799:03127e580980 40800:698477777883
    13 from . import (
    13 from . import (
    14     pycompat,
    14     pycompat,
    15 )
    15 )
    16 
    16 
    17 def openlogfile(ui, vfs, name, maxfiles=0, maxsize=0):
    17 def openlogfile(ui, vfs, name, maxfiles=0, maxsize=0):
       
    18     """Open log file in append mode, with optional rotation
       
    19 
       
    20     If maxsize > 0, the log file will be rotated up to maxfiles.
       
    21     """
    18     def rotate(oldpath, newpath):
    22     def rotate(oldpath, newpath):
    19         try:
    23         try:
    20             vfs.unlink(newpath)
    24             vfs.unlink(newpath)
    21         except OSError as err:
    25         except OSError as err:
    22             if err.errno != errno.ENOENT:
    26             if err.errno != errno.ENOENT: