From f00187f4ea187689ccc8095c438248640ad425ee Mon Sep 17 00:00:00 2001 From: freezed <2160318-free_zed@users.noreply.gitlab.com> Date: Sun, 18 Apr 2021 22:55:31 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Add=20logging=20events=20Info=20?= =?UTF-8?q?&=20Debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit relate to forga/process/fr/embarquement#6 --- tuto-pysdur/pgcd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tuto-pysdur/pgcd.py b/tuto-pysdur/pgcd.py index 00137bc..fd748bd 100755 --- a/tuto-pysdur/pgcd.py +++ b/tuto-pysdur/pgcd.py @@ -12,8 +12,11 @@ The goal is to build durable python script using standard library This script compute the greater common divisor of 2 integrers """ +import logging # MESSAGES +FUNCTION_CALL = "Function is called" +SUBSTRACTION_MADE = "Substraction made" WRONG_INPUT_ORDER = "Inputs in ascending order" @@ -32,10 +35,12 @@ def pgcd(input_a, input_b): >>> pgcd(910, 42) 14 """ + logging.info(FUNCTION_CALL) rest = input_a - input_b check = input_b - rest while check != 0: + logging.debug(SUBSTRACTION_MADE) input_a = max(input_b, rest) input_b = min(input_b, rest) rest = input_a - input_b @@ -53,7 +58,6 @@ if __name__ == "__main__": # ARGUMENTS, PARAMETERS & OPTIONS import argparse - import logging import sys PARSER = argparse.ArgumentParser(