-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog_python.py
More file actions
42 lines (39 loc) · 1.15 KB
/
Copy pathlog_python.py
File metadata and controls
42 lines (39 loc) · 1.15 KB
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
import logging
# Create and configure logger
LOG_FORMAT = "%(levelname)s %(asctime)s - %(message)s"
logging.basicConfig(filename="log_python.log",
level=logging.DEBUG,
format=LOG_FORMAT,
filemode='w')
logger = logging.getLogger()
# Test messages
logger.debug("This is a harmless debug message")
logger.info("Just some useful info")
logger.warning("Just some useful info")
logger.error("Did you just try to divide by zero?")
logger.critical("The entire internet is down!!")
# import math
#
# logger = logging.getLogger()
#
#
# def quadratic_formula(a, b, c):
# """Return the solutions to te equation ax^2 + bx + c = 0"""
# logger.info(f"quadratic_formula({a}, {b}, {c})")
#
# # Compute the discriminant
# logger.debug("# Compute the discriminant")
# disc = b ** 2 - 4 * a * c
#
# # Compute the two roots
# logger.debug("# Compute the two roots")
# root1 = (-b + math.sqrt(disc)) / (2 * a)
# root2 = (-b - math.sqrt(disc)) / (2 * a)
#
# # Return the roots
# logger.debug("# Return the roots")
# return (root1, root2)
#
#
# roots = quadratic_formula(1, 0, 1)
# print(roots)