comparison mercurial/loggingutil.py @ 40800:698477777883

loggingutil: document openlogfile() This function will be used later for command-server logging.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Nov 2018 18:35:31 +0900
parents 03127e580980
children 96be0ecad648
comparison
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: