Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def enable():
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles['asctime'] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles['debug'] = {}
coloredlogs.install(
level=log_level,
use_chroot=False,
fmt='%(asctime)s %(levelname)-8s %(name)s - %(message)s',
level_styles=level_styles,
field_styles=field_styles)
dbHandler = LoggingDbHandler()
dbHandler.setLevel(log_level)
logging.getLogger().addHandler(dbHandler)
logging.getLogger().addHandler(logging.FileHandler("logs.txt"))
#logging.getLogger('werkzeug').addHandler(dbHandler)
#socketio logging
def configure_colored_logging(loglevel: Text) -> None:
import coloredlogs
loglevel = loglevel or os.environ.get(ENV_LOG_LEVEL, DEFAULT_LOG_LEVEL)
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles["asctime"] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles["debug"] = {}
coloredlogs.install(
level=loglevel,
use_chroot=False,
fmt="%(asctime)s %(levelname)-8s %(name)s - %(message)s",
level_styles=level_styles,
field_styles=field_styles,
)
def configure_colored_logging(loglevel):
import coloredlogs
loglevel = loglevel or os.environ.get(ENV_LOG_LEVEL, DEFAULT_LOG_LEVEL)
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles["asctime"] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles["debug"] = {}
coloredlogs.install(
level=loglevel,
use_chroot=False,
fmt="%(asctime)s %(levelname)-8s %(name)s - %(message)s",
level_styles=level_styles,
field_styles=field_styles,
)
def configure_colored_logging(loglevel):
import coloredlogs
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles['asctime'] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles['debug'] = {}
coloredlogs.install(
level=loglevel,
use_chroot=False,
fmt='%(asctime)s %(levelname)-8s %(name)s - %(message)s',
level_styles=level_styles,
field_styles=field_styles)
def configure_colored_logging(loglevel):
import coloredlogs
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles['asctime'] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles['debug'] = {}
coloredlogs.install(
level=loglevel,
use_chroot=False,
fmt='%(asctime)s %(levelname)-8s %(name)s - %(message)s',
level_styles=level_styles,
field_styles=field_styles)
def configure_colored_logging(loglevel) -> None:
import coloredlogs
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles["asctime"] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles["debug"] = {}
coloredlogs.install(
level=loglevel,
use_chroot=False,
fmt="%(asctime)s %(levelname)-8s %(name)s - %(message)s",
level_styles=level_styles,
field_styles=field_styles,
)
def configure_colored_logging(loglevel):
import coloredlogs
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles['asctime'] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles['debug'] = {}
coloredlogs.install(
level=loglevel,
use_chroot=False,
fmt='%(asctime)s %(levelname)-8s %(name)s - %(message)s',
level_styles=level_styles,
field_styles=field_styles)
log_level = logging.DEBUG if debugging else logging.ERROR
logging.basicConfig(level=log_level, format='%(asctime)-15s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
logger = logging.getLogger('')
logger.setLevel(log_level)
if logfile_path:
lf = logging.FileHandler(logfile_path, mode='w')
lf.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s %(message)s')
lf.setFormatter(formatter)
logging.getLogger('').addHandler(lf)
if True:
field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy()
field_styles["asctime"] = {}
level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy()
level_styles["debug"] = {}
coloredlogs.install(
level=log_level,
use_chroot=False,
fmt="%(asctime)s %(levelname)-8s %(name)s - %(message)s",
level_styles=level_styles,
field_styles=field_styles,
)