-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogger.py
More file actions
20 lines (15 loc) · 691 Bytes
/
logger.py
File metadata and controls
20 lines (15 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import logging
def configure_logger():
logging.basicConfig(filename='/opt/gate-controller/logs/check-plate-and-open-gate.log',
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s')
# Get the root logger
logger = logging.getLogger()
# Create a handler for console output
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.INFO)
console_formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
console_handler.setFormatter(console_formatter)
# Add the console handler to the root logger
logger.addHandler(console_handler)
return logger