Hacked By AnonymousFox
"""
Initilazes the logging haandler used during program execution.
Concantenates recorded events to standard-out and designated logfile path.
"""
import logging
from pathlib2 import Path
if not Path.exists(Path('/var/log/hw_cpbackup/hw_cpbackup.log')):
Path.mkdir(Path('/var/log/hw_cpbackup'))
Path.touch(Path('/var/log/hw_cpbackup/hw_cpbackup.log'))
# define global logging definitions
stream_handler = logging.StreamHandler()
file_handler = logging.FileHandler(filename="/var/log/hw_cpbackup/hw_cpbackup.log", mode='a')
formatter = logging.Formatter("[HW_CPBACKUP]:[%(asctime)s]:[%(levelname)s]: ==> %(message)s", datefmt='%Y-%m-%d|%H:%M:%S')
stream_handler.setFormatter(fmt=formatter)
file_handler.setFormatter(fmt=formatter)
logger = logging.getLogger(name='hw_cpbackup')
logger.addHandler(hdlr=stream_handler)
logger.addHandler(hdlr=file_handler)
logger.setLevel(level=logging.INFO)
Hacked By AnonymousFox1.0, Coded By AnonymousFox