make log file destination configurable
This commit is contained in:
@@ -27,6 +27,11 @@ from ._seafile import (
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("-c", "--configdir", required=True, help="The config directory")
|
||||
parser.add_argument(
|
||||
"-l",
|
||||
"--logfile",
|
||||
help="The path to the logfile. Default: <configdir>/seafile_mirror.log",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d",
|
||||
"--dry",
|
||||
@@ -52,14 +57,17 @@ parser.add_argument(
|
||||
parser.add_argument("--version", action="version", version="%(prog)s " + __version__)
|
||||
|
||||
|
||||
def main(): # pylint: disable=too-many-locals, too-many-statements
|
||||
def main(): # pylint: disable=too-many-locals, too-many-statements, too-many-branches
|
||||
"""Main function"""
|
||||
args = parser.parse_args()
|
||||
# Set files depending on configdir
|
||||
configdir = args.configdir.rstrip("/") + "/"
|
||||
configfile = configdir + "seafile_mirror.conf.yaml"
|
||||
cachefile = configdir + ".seafile_mirror.db.json"
|
||||
logfile = configdir + "seafile_mirror.log"
|
||||
if args.logfile:
|
||||
logfile = args.logfile
|
||||
else:
|
||||
logfile = configdir + "seafile_mirror.log"
|
||||
|
||||
# Logging
|
||||
log = logging.getLogger()
|
||||
|
||||
Reference in New Issue
Block a user