🔊 Add logging events Info & Debug
relate to forga/process/fr/embarquement#6
This commit is contained in:
parent
1159d4b189
commit
f00187f4ea
|
@ -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
|
This script compute the greater common divisor of 2 integrers
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
|
|
||||||
# MESSAGES
|
# MESSAGES
|
||||||
|
FUNCTION_CALL = "Function is called"
|
||||||
|
SUBSTRACTION_MADE = "Substraction made"
|
||||||
WRONG_INPUT_ORDER = "Inputs in ascending order"
|
WRONG_INPUT_ORDER = "Inputs in ascending order"
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,10 +35,12 @@ def pgcd(input_a, input_b):
|
||||||
>>> pgcd(910, 42)
|
>>> pgcd(910, 42)
|
||||||
14
|
14
|
||||||
"""
|
"""
|
||||||
|
logging.info(FUNCTION_CALL)
|
||||||
rest = input_a - input_b
|
rest = input_a - input_b
|
||||||
check = input_b - rest
|
check = input_b - rest
|
||||||
|
|
||||||
while check != 0:
|
while check != 0:
|
||||||
|
logging.debug(SUBSTRACTION_MADE)
|
||||||
input_a = max(input_b, rest)
|
input_a = max(input_b, rest)
|
||||||
input_b = min(input_b, rest)
|
input_b = min(input_b, rest)
|
||||||
rest = input_a - input_b
|
rest = input_a - input_b
|
||||||
|
@ -53,7 +58,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# ARGUMENTS, PARAMETERS & OPTIONS
|
# ARGUMENTS, PARAMETERS & OPTIONS
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
PARSER = argparse.ArgumentParser(
|
PARSER = argparse.ArgumentParser(
|
||||||
|
|
Loading…
Reference in New Issue