module documentation

Dedicated module for defining and interpreting errors as well as generating error messages You're probably here for log_message or log_exception.

  • They take: message, level=("ERROR, "INFO", "WARNING", "DEBUG", "CRITICAL")

There's also a dict_check(dic, *args) that returns true if all args are keys in the dict. Usage:

  • from bootstraparse.modules.error_mngr import log_message, log_exception
  • log_message("This is a message", level="INFO") level=("ERROR, "INFO", "WARNING", "DEBUG", "CRITICAL")
  • log_exception(Exception("This is an exception"), level="ERROR")
  • dict_check({"a": 1, "b": 2}, "a", "b") # returns [True, True]
Class BootstraparseError Base class for all Bootstraparse errors
Class LonelyOptionalError Optional token could not be matched with last element in pile (not a container).
Class MismatchedContainerError The token is not final and cannot be contained. Indicative of a mismatched token.
Class ParsingError Exception class for parsing errors
Function init_logging Initializes logging :param filename: The path for the log file :param loglevel: The level of logging: "ERROR", "INFO", "WARNING", "DEBUG", "CRITICAL" :param filemode: The mode of the log file: "w", "a" :param handler: The handler to use :type filename: str :type loglevel: str :type filemode: str :type handler: logging...
Function log_exception Logs an exception :param exception: The exception to log :param level: The level of the exception :type level: str :return: None
Function log_message Logs a message :param message: The message to log :param level: The level of the message :type level: str :type message: str :return: None
Constant _ERRORS Undocumented
def init_logging(filename=None, loglevel='ERROR', filemode='w', handler=None):

Initializes logging :param filename: The path for the log file :param loglevel: The level of logging: "ERROR", "INFO", "WARNING", "DEBUG", "CRITICAL" :param filemode: The mode of the log file: "w", "a" :param handler: The handler to use :type filename: str :type loglevel: str :type filemode: str :type handler: logging.Handler :return: None

def log_exception(exception, level='ERROR'):

Logs an exception :param exception: The exception to log :param level: The level of the exception :type level: str :return: None

def log_message(message, level='ERROR'):

Logs a message :param message: The message to log :param level: The level of the message :type level: str :type message: str :return: None

_ERRORS: list[str] =

Undocumented

Value
['ParsingError', 'MismatchedContainerError']