diff --git a/mirror_from_pagure.py b/mirror_from_pagure.py index f91938d..d8f62ae 100644 --- a/mirror_from_pagure.py +++ b/mirror_from_pagure.py @@ -50,23 +50,24 @@ def run_command(command, cwd=None): def mirror_from_pagure(): """ Sync packagers and schedules the next one. """ for url in urls: + _log.info("Syncing %s", url) name = url.rsplit("/", 1)[-1] dest_folder = os.path.join(mirror_folder, name) if not os.path.exists(dest_folder): + _log.info(" Cloning as new %s", url) cmd = ["git", "clone", "--mirror", url] run_command(cmd, cwd=mirror_folder) + _log.info(" Running git fetch") cmd = ["git", "fetch"] run_command(cmd, cwd=dest_folder) + _log.info(" Running git fsck") cmd = ["git", "fsck"] run_command(cmd, cwd=dest_folder) - print( - "%s Run finished, next run in %s seconds" - % (datetime.datetime.utcnow().isoformat(), delay) - ) + _log.info("Run finished, next run in %s seconds", delay) s.enter(delay, 1, mirror_from_pagure, argument=()) @@ -89,4 +90,7 @@ def run(): if __name__ == "__main__": + formater = '%(asctime)-15s %(message)s' + logging.basicConfig(format=formater) + _log.setLevel(logging.INFO) main()