NaxToPy.Core.Errors package

Contents

NaxToPy.Core.Errors package#

Submodules#

NaxToPy.Core.Errors.N2PLog module#

class NaxToPy.Core.Errors.N2PLog.N2PLog#

Bases: ABC

Class prepared for the control of the program.

It uses the module logging to register the main instructions and data of the NaxToPy Package. It can’t be instanced.

Attributes:

LevelList

class Critical#

Bases: object

Class with all the critical errors.

The critical are methods that do not return anything, they write in the log file and console the error. Optionally a raise Exception could be added. Always a sys.exit() should be executed at the end.

static user(message: str) None#

Method prepared to be called by the user for adding CRITICAL errors to the loggin.

Anyone who is using NaxToPy can write in the register their own CRITICAL error message. Use the following structure as a standard message (C + four digits + Body).

Args:

message: str

Example:

“CXXXX: BODY OF THE MESSAGE”

class Debug#

Bases: object

Class with all the debug data.

The DXXX are methods that keep in the register the information in the debuggibg procces about the processes that the package is keeping. Use only in the debug stages.

static user(message: str) None#

Method prepared to be called by the user for adding debugs data to the loggin

Anyone who is using NaxToPy can write in the register their own debug message. Use the following structure as a standard message (D + four digits + Body).

Args:

message: str

Example:

“DXXXX: Body of the message”

class Error#

Bases: object

Class with all the errors that can be expected.

They should be handeled by a try-exception clasule. The errors are method that do not return anything, they write in the log file and console the error.

static user(message: str) None#

Method prepared to be called by the user for adding errors to the loggin

This anyone who is using NaxToPy can write in the register their own error message. Use the following structure as a standard message (E + four digits + Body).

Args:

message: str

Example:

“EXXXX: BODY OF THE MESSAGE”

class Info#

Bases: object

Class with all the information data. The IXXX are methods that keep in the register the information about the processes that the package is keeping.

static user(message) None#

Method prepared to be used by the user so anyone who is using NaxToPy can write in the register their own information message. Use the following structure as a standard message (I + four digits + Body).

“IXXXX: Body of the message”

class property LevelList: list[str]#

Property that retuns the list with the message levels in the log

class Warning#

Bases: object

Class with all the warnings. The WXXX are methods that keep in the register the warnings that might be revised. They don’t affect directly to the correct working of the package.

static user(message) None#

Method prepared to be used by the user so anyone who is using NaxToPy can write in the register their own warning message. Use the following structure as a standard message (W + four digits + Body).

“WXXXX: Body of the message”

classmethod activate_log() None#

Method that activates the .log

clv = 'WARNING'#
classmethod deactivate_log() None#

Method that deactivates the .log

flv = 'INFO'#
classmethod get_directory() str#

Method that returns the folder where the .log file is being saved

classmethod get_file_name() str#

Method that returns the name of the file of the .log

classmethod set_console_level(clv: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) None#

Method to set a different level for console register. The default level is “WARNING”. Only The level register and higher will be printed in the console. The possible levels are:

“DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”.

classmethod set_directory(value: str) None#

Method that sets the folder where the .log file must be saved

Args:

value: str -> Path to the folder where the .log must be saved.

classmethod set_file_level(flv: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) None#

Method to set a different level for the file .log of the register. The default level is “INFO”. Only The level register and higher will be printed in the .log file. Higher levels could make more difficult to track errors. The possible levels are:

“DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”.

classmethod set_file_name(value: str) None#

Method that sets the name of the file of the .log

Args:

value: str -> Name of the .log file

Module contents#