-
Notifications
You must be signed in to change notification settings - Fork 1
/
dice_test.py
38 lines (26 loc) · 1.08 KB
/
dice_test.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
# This is a dice test program for calling PyDiceroll
from PyDiceroll import roll
import os
import logging
__app__ = 'dice_test'
if __name__ == '__main__':
'''
Technically, this program starts right here when run.
If this program is imported instead of run, none of the code below is executed.
'''
# logging.basicConfig(filename = 'dice_test.log',
# level = logging.DEBUG,
# format = '%(asctime)s %(levelname)s %(name)s - %(message)s',
# datefmt='%a, %d %b %Y %H:%M:%S',
# filemode = 'w')
log = logging.getLogger('your_logger_function_here')
log.setLevel(logging.DEBUG)
if not os.path.exists('Logs'):
os.mkdir('Logs')
fh = logging.FileHandler('Logs/dice_test.log', 'w')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s - %(message)s', datefmt = '%a, %d %b %Y %H:%M:%S')
fh.setFormatter(formatter)
log.addHandler(fh)
log.info('Logging started.')
log.info(__app__ + ' started, and running...')
print(roll('2d12'))