| Server IP : 142.11.234.102 / Your IP : 216.73.217.78 Web Server : Apache System : Linux dal-shared-66.hostwindsdns.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : krnuyqrm ( 1183) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /lib/python2.7/site-packages/hw_cpbackup/util/ |
Upload File : |
"""
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)