for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
"""
Log script
import logging
from db_sync_tool.utility import system
#
# GLOBALS
logger = None
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.
# FUNCTIONS
def init_logger():
Initialize the logger instance
:return:
global logger
global
Usage of global can make code hard to read and test, its usage is generally not recommended unless you are dealing with legacy code.
logger = logging.getLogger('db_sync_tool')
logger.setLevel(logging.DEBUG)
if system.config:
if 'log_file' in system.config:
fh = logging.FileHandler(system.config['log_file'])
fh.setLevel(logging.DEBUG)
logger.addHandler(fh)
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
def get_logger():
Return the logger instance
if logger is None:
init_logger()
return logger
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.