Skip to content
Snippets Groups Projects
Commit dc0e2ffa authored by Ralf Mueller's avatar Ralf Mueller :fishing_pole_and_fish:
Browse files

add examples for debugging methods

parent df39ebfd
No related branches found
No related tags found
1 merge request!2Draft: add link to debugging document
Pipeline #11344 failed
import sys
import logging
#logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG, format='%(asctime)s :: %(levelname)s :: %(message)s')
def sum(a,b):
logging.debug("started method sum()")
logging.info("Got a = {0} of type {1}".format(a,type(a)))
logging.info("Got b = {0} of type {1}".format(b,type(b)))
return a+b
if __name__ == "__main__":
a,b = sys.argv[1], sys.argv[2]
print("{a}+{b}= {sum}".format(sum=sum(a,b),a=a,b=b))
import sys
def sum(a,h):
return a+h
if __name__ == "__main__":
# not some user given numbers
a = sys.argv[1]
b = sys.argv[2]
print("a = {0}".format(a))
print("b = {0}".format(b))
print("sum = {0}".format(sum(a,b)))
import sys
def sum(a,h):
return a+h
if __name__ == "__main__":
# first some tests
print("2 = {0}".format(sum(1,1)))
print("5 = {0}".format( sum(1,4)))
print("4 = {0}".format(sum(2,2)))
# not some user given numbers
a = sys.argv[1]
b = sys.argv[2]
print("a = {0}".format(a))
print("b = {0}".format(b))
print("sum = {0}".format(sum(a,b)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment