make log file destination configurable
This commit is contained in:
@@ -27,6 +27,11 @@ from ._seafile import (
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("-c", "--configdir", required=True, help="The config directory")
|
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(
|
parser.add_argument(
|
||||||
"-d",
|
"-d",
|
||||||
"--dry",
|
"--dry",
|
||||||
@@ -52,13 +57,16 @@ parser.add_argument(
|
|||||||
parser.add_argument("--version", action="version", version="%(prog)s " + __version__)
|
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"""
|
"""Main function"""
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
# Set files depending on configdir
|
# Set files depending on configdir
|
||||||
configdir = args.configdir.rstrip("/") + "/"
|
configdir = args.configdir.rstrip("/") + "/"
|
||||||
configfile = configdir + "seafile_mirror.conf.yaml"
|
configfile = configdir + "seafile_mirror.conf.yaml"
|
||||||
cachefile = configdir + ".seafile_mirror.db.json"
|
cachefile = configdir + ".seafile_mirror.db.json"
|
||||||
|
if args.logfile:
|
||||||
|
logfile = args.logfile
|
||||||
|
else:
|
||||||
logfile = configdir + "seafile_mirror.log"
|
logfile = configdir + "seafile_mirror.log"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
|
|||||||
Reference in New Issue
Block a user