knit_script.knit_script_interpreter.knitscript_logging.knitscript_logger module
A Module containing the Knit_Script_Logger class
- class KnitScript_Logging_Level(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumEnumeration of logging levels for Knit_Script_Logger. Wraps the standard logging levels in the logging package.
- info = 20
- debug = 10
- warning = 30
- error = 40
- critical = 50
- print(message, logger)[source]
Prints the message to the appropriate level using the given logger. :param message: The message to print. :type message: str :param logger: The logger to print from. :type logger: Logger
- classmethod __contains__(member)
Return True if member is a member of this enum raises TypeError if member is not an enum member
note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum
- classmethod __getitem__(name)
Return the member matching name.
- classmethod __iter__()
Return members in definition order.
- classmethod __len__()
Return the number of members (no aliases)
- class Knit_Script_Logger(log_to_console=True, log_to_file=False, logging_level=KnitScript_Logging_Level.info, log_name='KnitScript Console')[source]
Bases:
objectA wrapping class for custom logging functionality used to control logging from knitscript separate from the python console.
- __init__(log_to_console=True, log_to_file=False, logging_level=KnitScript_Logging_Level.info, log_name='KnitScript Console')[source]
- Parameters:
log_to_console (bool, optional) – If True, the logger will output its contents to the python console. Defaults to True.
log_to_file (bool, optional) – If True, the logger will output its contents to a log file. Defaults to False.
logging_level (KnitScript_Logging_Level, optional) – The logging level of this logger. Defaults to logging information.
log_name (str, optional) – The name of the logger and the log file produced. Defaults to “KnitScript”.
- class KnitScript_Warning_Log(log_to_console=True, log_to_file=False, log_name='KnitScript Warnings')[source]
Bases:
Knit_Script_LoggerUsed for logging warning messages from Knit Script.
- __init__(log_to_console=True, log_to_file=False, log_name='KnitScript Warnings')[source]
- Parameters:
log_to_console (bool, optional) – If True, the logger will output its contents to the python console. Defaults to True.
log_to_file (bool, optional) – If True, the logger will output its contents to a log file. Defaults to False.
logging_level (KnitScript_Logging_Level, optional) – The logging level of this logger. Defaults to logging information.
log_name (str, optional) – The name of the logger and the log file produced. Defaults to “KnitScript”.
- warn(warning, source_element)[source]
Prints out the given warning message. :param warning: The warning message to print. :type warning: RuntimeWarning :param source_element: The KS element that is the source of the warning. :type source_element: Any
- print(message)
Prints the given message using this logger at the set level. If this is the first message printed by the logger, it will add a start line to the output. :param message: The message to print. :type message: str
- class KnitScript_Error_Log(log_to_console=True, log_to_file=False, log_name='KnitScript Errors')[source]
Bases:
Knit_Script_LoggerUsed for logging error messages from Knit Script.
- __init__(log_to_console=True, log_to_file=False, log_name='KnitScript Errors')[source]
- Parameters:
log_to_console (bool, optional) – If True, the logger will output its contents to the python console. Defaults to True.
log_to_file (bool, optional) – If True, the logger will output its contents to a log file. Defaults to False.
logging_level (KnitScript_Logging_Level, optional) – The logging level of this logger. Defaults to logging information.
log_name (str, optional) – The name of the logger and the log file produced. Defaults to “KnitScript”.
- report_error(error, source_element)[source]
Prints out the given error message. :param error: The error to report. :type error: BaseException :param source_element: The KS element that is the source of the error. :type source_element: Any
- print(message)
Prints the given message using this logger at the set level. If this is the first message printed by the logger, it will add a start line to the output. :param message: The message to print. :type message: str
- class KnitScript_Debug_Log(log_to_console=True, log_to_file=False, log_name='KnitScript Debugger')[source]
Bases:
Knit_Script_LoggerUsed for logging debug messages from Knit Script.
- __init__(log_to_console=True, log_to_file=False, log_name='KnitScript Debugger')[source]
- Parameters:
log_to_console (bool, optional) – If True, the logger will output its contents to the python console. Defaults to True.
log_to_file (bool, optional) – If True, the logger will output its contents to a log file. Defaults to False.
logging_level (KnitScript_Logging_Level, optional) – The logging level of this logger. Defaults to logging information.
log_name (str, optional) – The name of the logger and the log file produced. Defaults to “KnitScript”.
- print(message)
Prints the given message using this logger at the set level. If this is the first message printed by the logger, it will add a start line to the output. :param message: The message to print. :type message: str