-
Notifications
You must be signed in to change notification settings - Fork 1
/
debugginf.py
47 lines (32 loc) · 1.1 KB
/
debugginf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import logging
logging.basicConfig(filename='myLog.txt', level=logging.DEBUG, format = '%(asctime)s - %(levelname)s - %(message)s')
"""
****************
* *
* *
* *
****************
"""
def boxPrint(symbol, width, height):
if len(symbol) != 1:
raise Exception('"symbol" needs a string of length 1.')
if (width < 2) or (height < 2):
raise Exception('Width and height must need 2 or higher')
print(symbol * width)
for i in range(height - 2):
print(symbol + (" " * (width - 2)) + symbol)
print(symbol * width)
boxPrint('*', 10, 4)
# There are five log levels 1.debug(lowest), 2.info, 3.warning, 4.error, 5.critical(Highest)
# disable logging module
#logging.disable(logging.CRITICAL)
logging.debug('Start of program')
def factorial(n):
logging.debug('start of factorial(%s)' % (n))
total = 1
for i in range(1, n+1):
total = total * i
logging.debug('i is %s, total is %s' %(i, total))
return total
print(factorial(7))
logging.debug('End of program')