-
Notifications
You must be signed in to change notification settings - Fork 4
/
example.py
44 lines (31 loc) · 929 Bytes
/
example.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
import logging
import sys
import fancylog
class MadeUpPaths:
def __init__(self):
self.path1 = "/path/to/the_first_place"
self.path2 = "/path/to/the_second_place"
self.path3 = "/path/to/the_third_place"
class MadeUpArgs:
def __init__(self):
self.arg1 = True
self.another_arg = "path/to/somewhere"
self.the_last_arg = 1000
self.paths = MadeUpPaths()
def main(directory):
args = MadeUpArgs()
verbose = True
fancylog.start_logging(
directory,
fancylog,
variables=[args, args.paths],
verbose=verbose,
timestamp=True,
logger_name="my_logger",
)
logger = logging.getLogger("my_logger")
logger.info("This is an info message")
logger.debug("This is a debug message")
logger.warning("This fun logging experience is about to end :(")
if __name__ == "__main__":
main(sys.argv[1])