Utils Module
This module provides helper function.
Prerequisites:
Python > 3.7
- utils.isXMLValid(data: str)
Check if an XML string is valid or not. Also provide the invalid tags and elements
- Parameters
data – (
string
) - XML string to be checked.- Returns
(
tuple
- bool, dict) - The first item in the tuple is whether the string is a valid XML or not. The second item is a dictionary of missingTags and missingChars.
- utils.launchDocs()
Launches documentation in the default OS browser
- Returns
No return
- utils.print_log(msg, logger=None, logLvl=20)
Print message to console and log in logger
- Parameters
msg – (
string
) - Message to be printedlogger – (
Logger
- optional) - Logger variable to be used to print in log file (default value None)logLvel – (
int
- optional) - Logging level number (default value logging.INFO, which is equivalent to 20)
- Returns
No return
- utils.setup_logger(name, log_file, formatter=None, logLvl=20)
Setup logger to create a log file
- Parameters
name – (
string
) - Name of the loggerlog_file – (
string
) - Name of the log fileformatter – (
string
- optional) - Format of the log file (default value None)logLvel – (
int
- optional) - Logging level number (default value logging.INFO, which is equivalent to 20)
- Returns
(
Logger
) - Logger object