diff --git a/docs/source/conf.py b/docs/source/conf.py index a52279c..ddf11c4 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -31,6 +31,10 @@ '.md': 'markdown', } +latex_documents = [ + (master_doc, 'project_name.tex', 'Project Name Documentation', 'Your Name', 'manual'), +] + # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output diff --git a/docs/source/data.rst b/docs/source/data.rst index 74af858..68f304b 100644 --- a/docs/source/data.rst +++ b/docs/source/data.rst @@ -132,6 +132,8 @@ Animations - Line - BlockVerticalFill +.. _ansi: + Tree of ANSI escape code ------------------------ diff --git a/docs/source/how_to_use.rst b/docs/source/how_to_use.rst index 37e9b6b..42395ce 100644 --- a/docs/source/how_to_use.rst +++ b/docs/source/how_to_use.rst @@ -588,8 +588,8 @@ Modification of a Logger means any change to its Buffer. And sorting, and search Sorting can be done by four keys: -1. Sort by entering *time* -2. Sort by entering *time in reverse order* +1. Sort by entry *time* +2. Sort by entry *time in reverse order* 3. Sort by entry *category* 4. Sort by entry *type* diff --git a/docs/source/logger-class.rst b/docs/source/logger-class.rst new file mode 100644 index 0000000..ae5bef7 --- /dev/null +++ b/docs/source/logger-class.rst @@ -0,0 +1,187 @@ +Logger class +============ + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + :hidden: + + mighty_logger-class + +Logger +------ + +.. hint:: To use, you need to enter + + .. code-block:: python + :linenos: + + from mighty_logger import Logger + +.. currentmodule:: mighty_logger.simple_logger + +.. py:class:: Logger(*[, program_name: str = "Unknown", log_environment: EnvironmentType = LogEnvironments.PLAIN, console_width: int = 60, icon_set: int = 1, global_bold_font: bool = False, global_italic_font: bool = False, global_invert_font: bool = False, global_background: bool = False]) + + Lightweight Logger automates work with entry types. We can say, figuratively, this class restores the Logger from v0.1.0. + + .. versionadded:: 0.7.0 + + :param program_name: The name of the program being logged + :type program_name: str + :param log_environment: Mighty Logger environment + :type log_environment: EnvironmentType + :param console_width: Console width + :type console_width: int + :param icon_set: Icon set number + :type icon_set: int + :param global_bold_font: Sets the global setting "bold font" + :type global_bold_font: bool + :param global_italic_font: Sets the global setting "italic font" + :type global_italic_font: bool + :param global_invert_font: Sets the global setting "invert font" + :type global_invert_font: bool + :param global_background: Sets the global setting "background" + :type global_background: bool + + .. property:: might + + Mighty Logger. + + .. versionadded:: v0.9.3 + + :rtype: MightyLogger + + .. py:method:: debug(message_text: str) -> None + + Debugging information logging: Can be used to log entry any information while debugging an application. + + .. versionadded:: 0.0.1 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: debug_performance(message_text: str) -> None + + Performance debugging information logging: Can be used to log entry the execution time of operations or other performance information while the application is being debugged. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: performance(message_text: str) -> None + + Performance information logging: Can be used to log entry the execution time of operations or other application performance information. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: event(message_text: str) -> None + + Event information logging: Can be used to log entry specific events in the application, such as button presses or mouse cursor movements. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: audit(message_text: str) -> None + + Audit information logging: Can be used to log entry changes in the system, such as creating or deleting users, as well as changes in security settings. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: metrics(message_text: str) -> None + + Metrics information logging: Can be used to log entry metrics to track application performance and identify issues. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: user(message_text: str) -> None + + User information logging: Can be used to log entry custom logs to store additional information that may be useful for diagnosing problems. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: message(message_text: str) -> None + + Message information logging: Can be used for the usual output of ordinary messages about the program's operation. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: info(message_text: str) -> None + + Default information logging: Can be used to log entry messages with specific content about the operation of the program. + + .. versionadded:: 0.0.1 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: notice(message_text: str) -> None + + Notice information logging: Can be used to flag important events that might be missed with a normal logging level. + + .. versionadded:: 0.0.3 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: warning(message_text: str) -> None + + Warning information logging: Can be used to log entry warnings that the program may work with unpredictable results. + + .. versionadded:: 0.0.1 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: error(message_text: str) -> None + + Error information logging: Used to log entry errors and crashes in the program. + + .. versionadded:: 0.0.1 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: critical(message_text: str) -> None + + Critical error information logging: Used to log entry for critical and unpredictable program failures. + + .. versionadded:: 0.0.1 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: success(message_text: str) -> None + + Success information logging: Used to log entry a message about the success of the process. + + .. versionadded:: 0.0.2 + + :param message_text: Log entry message + :type message_text: str + + .. py:method:: fail(message_text: str) -> None + + Fail information logging: Used to log entry a message about the failed execution of the process. + + .. versionadded:: 0.0.2 + + :param message_text: Log entry message + :type message_text: str diff --git a/docs/source/mighty_logger-basic-lib_types-package.rst b/docs/source/mighty_logger-basic-lib_types-package.rst index 5b1290b..c186303 100644 --- a/docs/source/mighty_logger-basic-lib_types-package.rst +++ b/docs/source/mighty_logger-basic-lib_types-package.rst @@ -42,6 +42,8 @@ _______________________ Type IndefiniteAnimationType ____________________________ +.. _indefinite_animation_type: + .. py:class:: IndefiniteAnimationType(animation: list) Wrapper class for indefinite animations type. @@ -51,12 +53,16 @@ ____________________________ :param animation: List of animation strings :type animation: list + .. hint:: If this class is used as an argument type - just pass the value of one of the available attributes of the :ref:`List of animations `. + .. seealso:: - `Type BasicAnimationType`_ Type DefiniteAnimationType __________________________ +.. _definite_animation_type: + .. py:class:: DefiniteAnimationType(animation: list) Wrapper class for definite animations type. @@ -66,6 +72,8 @@ __________________________ :param animation: List of animation strings :type animation: list + .. hint:: If this class is used as an argument type - just pass the value of one of the available attributes of the :ref:`List of progress bars `. + .. seealso:: - `Type BasicAnimationType`_ @@ -74,6 +82,8 @@ Type EntryType .. currentmodule:: mighty_logger.basic.lib_types.entry_type +.. _entry_type: + .. py:class:: EntryType(*, type_category: str, type_name: str, time_color: tuple, status_color: tuple, type_color: tuple, message_color: tuple, background_color: tuple, icon: tuple) The data type that characterizes the entry type. @@ -97,6 +107,8 @@ Type EntryType :param icon: Entry type icon :type icon: tuple + .. hint:: If this class is used as an argument type - just pass the value of one of the available attributes of the :ref:`Entry types collections `. + .. property:: type_category Entry type category. @@ -166,6 +178,8 @@ Type EnvironmentType .. currentmodule:: mighty_logger.basic.lib_types.environment_type +.. _environment_type: + .. py:class:: EnvironmentType(environment_name: str, environment_code: int, updatable: bool, weak_environment: bool) A data type that characterizes the environments in which the Logger can operate. @@ -181,6 +195,8 @@ Type EnvironmentType :param weak_environment: Is the environment weak (requires preconfiguration)? :type weak_environment: bool + .. hint:: If this class is used as an argument type - just pass the value of one of the available attributes of the :ref:`Logger environments collections `. + .. property:: environment_name The name of the environment. @@ -218,6 +234,8 @@ Type SortingKeyType .. currentmodule:: mighty_logger.basic.lib_types.sorting_key_type +.. _sorting_key_type: + .. py:class:: SortingKeyType(sorting_key: str) A data type that characterizes the sort keys for entries. @@ -227,6 +245,8 @@ Type SortingKeyType :param sorting_key: A string describing the sort key :type sorting_key: str + .. hint:: If this class is used as an argument type - just pass the value of one of the available attributes of the :ref:`Sorting keys collections `. + .. property:: sorting_key The sort key number. @@ -235,6 +255,8 @@ Type SortingKeyType :rtype: str +.. _text_buffer_type: + Type TextBufferType ------------------- @@ -249,6 +271,9 @@ Type TextBufferType :param env: Text Buffer environment :type env: EnvironmentType + .. seealso:: + - Read about inherited classes in the section :ref:`Text Buffers `. + .. property:: text_buffer List of strings of the Text Buffer. @@ -295,6 +320,8 @@ Type TextBufferType :param name_file: The name of the file where you want to save the Text Buffer :type name_file: str + .. _text_buffer_type_append: + .. py:method:: append(message: str) -> None Adds a string to the end of the Text Buffer. @@ -303,6 +330,15 @@ Type TextBufferType :param message: The string to be added :type message: str + :raises NotImplementedError: Method append() is not implemented in the base class + + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_insert: .. py:method:: insert(number_string: int, message: str) -> None @@ -316,6 +352,14 @@ Type TextBufferType :type message: str :raises NotImplementedError: Method insert() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_replace: + .. py:method:: replace(number_string: int, message: str) -> None Replaces a specific string in a Text Buffer. If there is no such string, the method fills the list with empty strings up to the required position and *adds* the string. @@ -328,6 +372,14 @@ Type TextBufferType :type message: str :raises NotImplementedError: Method replace() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_pop: + .. py:method:: pop([number_string: int = -1]) -> str Removes and returns the specified string from the Text Buffer. @@ -340,6 +392,14 @@ Type TextBufferType :rtype: str :raises NotImplementedError: Method pop() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_remove: + .. py:method:: remove([number_string: int = -1]) -> None Deletes without returning the specified string from the Text Buffer. @@ -350,6 +410,14 @@ Type TextBufferType :type number_string: int :raises NotImplementedError: Method remove() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_clear: + .. py:method:: clear() -> None Clears the entire Text Buffer, making it empty. @@ -358,6 +426,14 @@ Type TextBufferType :raises NotImplementedError: Method clear() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_save: + .. py:method:: save(name_file: str, clean: bool) -> None Saves the text of the Text Buffer to a file. @@ -370,6 +446,14 @@ Type TextBufferType :type clean: bool :raises NotImplementedError: Method save() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_load: + .. py:method:: load(name_file: str) -> None Loads the text of the Text Buffer from a file. @@ -380,6 +464,14 @@ Type TextBufferType :type name_file: str :raises NotImplementedError: Method load() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_input: + .. py:method:: input(input_text: str) -> None A wrapper method for the standard Python input() that prepares the Text Buffer before using this function, and performs certain actions after, so that the Text Buffer can continue to function normally. @@ -392,13 +484,29 @@ Type TextBufferType :rtype: str :raises NotImplementedError: Method input() is not implemented in the base class + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_update_console: + .. py:method:: update_console() -> None Refreshes the console, erasing output text and outputting an updated buffer. .. versionadded:: v0.5.0-dev - :raises NotImplementedError: Method append() is not implemented in the base class + :raises NotImplementedError: Method update_console() is not implemented in the base class + + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. + + .. _text_buffer_type_update_entry: .. py:method:: update_entry() -> None @@ -406,4 +514,10 @@ Type TextBufferType .. versionadded:: v0.6.0 - :raises NotImplementedError: Method append() is not implemented in the base class + :raises NotImplementedError: Method update_entry() is not implemented in the base class + + .. seealso:: + Read the method definitions in + + - :ref:`BasicTextBuffer `; + - :ref:`TextBuffer `. diff --git a/docs/source/mighty_logger-basic-package.rst b/docs/source/mighty_logger-basic-package.rst index 80ac057..852bea6 100644 --- a/docs/source/mighty_logger-basic-package.rst +++ b/docs/source/mighty_logger-basic-package.rst @@ -10,7 +10,7 @@ A package with base classes intended for use within a library. -.. versionadded:: 0.2.0 +.. versionadded:: v0.2.0 .. hint:: To use, you need to enter @@ -19,20 +19,30 @@ A package with base classes intended for use within a library. from mighty_logger.basic import ... +Class BasicLogger +----------------- + +.. danger:: This is a hidden functionality that is inaccessible outside the library. + .. currentmodule:: mighty_logger.basic.basic_logger -.. rubric:: class BasicLogger .. py:class:: BasicLogger(program_name: str, env: EnvironmentType) The base class of the Logger, which stores the main attributes and implements the most important functionality - the formation of the Logger entry string. - :since: v0.2.0 + .. versionadded:: v0.2.0 + + :param program_name: The name of the program whose is being logged + :type program_name: str + :param env: Logger environment + :type env: EnvironmentType .. py:method:: _initialized_data(colors: list[str, str]) -> str A method that assemble an entry of system initialized data. - :since: v0.3.0 + .. versionadded:: v0.3.0 + :param colors: Color string list of initialized data :type colors: list[str, str] :return: A string with initialized data @@ -42,7 +52,8 @@ A package with base classes intended for use within a library. A method that assemble an entry into a string and returns it. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param entry_type: Type of entry to be generated :type entry_type: EntryType :param icon_set: Icon set number @@ -57,91 +68,150 @@ A package with base classes intended for use within a library. :rtype: str :raises MessageException: Message is too short (less than 10 characters) +Library exceptions +------------------ + .. currentmodule:: mighty_logger.basic.exceptions -.. rubric:: exception ColorException +Exception ColorException +________________________ + .. py:exception:: ColorException(message: str) The exception that is thrown when there is no color in any palette. - :since: v0.0.4 + .. versionadded:: v0.0.4 + + :param message: Exception message + :type message: str + +Exception ReCreationException +_____________________________ -.. rubric:: exception ReCreationException .. py:exception:: ReCreationException(message: str) The exception that is thrown when an object of the Singleton category is re-created. - :since: v0.5.0 + .. versionadded:: v0.5.0 + + :param message: Exception message + :type message: str + +Exception EnvironmentException +______________________________ -.. rubric:: exception EnvironmentException .. py:exception:: EnvironmentException(message: str) The exception that is thrown when on environmental errors. - :since: v0.7.0 + .. versionadded:: v0.7.0 + + :param message: Exception message + :type message: str + +Exception InitException +_______________________ -.. rubric:: exception InitException .. py:exception:: InitException(message: str) The exception thrown on errors during initialization. - :since: v0.7.0 + .. versionadded:: v0.7.0 + + :param message: Exception message + :type message: str + +Exception MessageException +__________________________ -.. rubric:: exception MessageException .. py:exception:: MessageException(message: str) The exception that is thrown when a write message is too short. - :since: v0.8.0 + .. versionadded:: v0.8.0 + + :param message: Exception message + :type message: str + +Class Exporter +-------------- + +.. danger:: This is a hidden functionality that is inaccessible outside the library. .. currentmodule:: mighty_logger.basic.exporter -.. rubric:: class Exporter .. py:class:: Exporter(entries: list[str], environment: EnvironmentType) A class that implements the functionality of exporting a string in the format of Logger entries to other formats. - :property: entries - :since: v0.8.0 + .. versionadded:: v0.8.0 + + :param entries: List of entries to be exported + :type entries: list[str] + :param environment: The environment in which the list of entries was formed + :type environment: EnvironmentType + + .. property:: entries + + List of entries from which the csv table is formed. + + .. versionadded:: v0.8.0 .. py:method:: export_to_csv() The method that implements the export of Logger entries rows to the csv table format. The strings are converted into dictionaries, from which it will then be possible to assemble a csv table at the time the file is saved in the new format. This method does not implement saving the exported data. - :since: 0.8.0 + .. versionadded:: v0.8.0 .. py:method:: save_to_csv(file_name: str) Implements the saving of the generated dictionary strings to the csv file of the table. - :since: v0.8.0 + .. versionadded:: v0.8.0 + :param file_name: The name of the file where you want to save the csv table :type file_name: str +Class Modifier +-------------- + +.. danger:: This is a hidden functionality that is inaccessible outside the library. + .. currentmodule:: mighty_logger.basic.modifier -.. rubric:: class Modifier .. py:class:: Modifier(entries: list[str], environment: EnvironmentType) A class that implements Looger's modification. Modification means any change in the Logger Text Buffer, namely, changing entries, moving, deleting and adding. Sorting, searching, and selecting algorithms make just such an impact on the Logger's Text Buffer. - :property: entries - :since: 0.7.1 + .. versionadded:: v0.7.1 + + :param entries: List of entries to be exported + :type entries: list[str] + :param environment: The environment in which the list of entries was formed + :type environment: EnvironmentType + + .. property:: entries + + List of entries from which the csv table is formed. + + .. versionadded:: v0.7.1 .. py:method:: sort(key: SortingKeyType) Method for sorting entries by key. The sort key is "sort by time", "sort by time in reverse order", "sort by category" and "sort by type". - :since: v0.7.1 + .. versionadded:: v0.7.1 + :param key: The key to sort by :type key: SortingKeyType .. py:method:: search(keyword: str, empty: bool) - A method that implements the search for entries in messages by a keyword/letter/phrase. It is possible to enable search not only in entries, but also in empty (custom) entries. + A method that implements the search for entries in messages by a words/letters/phrases. It is possible to enable search not only in entries, but also in empty (custom) entries. + + .. versionadded:: v0.7.1 - :since: v0.7.1 - :param keyword: Keyword/letter/phrase + :param keyword: Words/letters/phrases :type keyword: str :param empty: Flag indicating whether to search in custom strings :type empty: bool @@ -150,216 +220,378 @@ A package with base classes intended for use within a library. A method that selects entries either by a specific type or by an entire category. - :since: v0.7.1 + .. versionadded:: v0.7.1 + :param entry_type: Entries type/category :type entry_type: EntryType +Pattern Singleton +----------------- + +.. danger:: This is a hidden functionality that is inaccessible outside the library. + .. currentmodule:: mighty_logger.basic.singleton -.. rubric:: class Singleton .. py:class:: Singleton A class that implements the Singleton pattern. - :since: v0.2.0 + .. versionadded:: v0.2.0 + +.. _text_buffers: + +Text Buffers +------------ .. currentmodule:: mighty_logger.basic.text_buffer -.. rubric:: type BasicAnimationType +Basic Text Buffer +_________________ + .. py:class:: BasicTextBuffer(env: EnvironmentType) A class with a basic implementation of a simple Text Buffer. It is intended to be used in conjunction with HTML, but this is optional. - :since: v0.4.0 + .. versionadded:: v0.4.0 + + :param env: Text Buffer environment + :type env: EnvironmentType + + .. seealso:: + - Read the definition of the base class in :ref:`Type TextBufferType `. + + .. _basic_text_buffer_append: .. py:method:: append(message: str) Adds a string to the end of the Text Buffer. - :since: v0.4.0 + .. versionadded:: v0.4.0 + :param message: The string to be added :type message: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.append() `. + + .. _basic_text_buffer_insert: + .. py:method:: insert(number_string: int, message: str) Adds a string to the middle of the Text Buffer at the specified position. - :since: v0.4.0 + .. versionadded:: v0.4.0 + :param number_string: Position (number) of the line to which you need to add a string :type number_string: int :param message: The string to be placed on the position :type message: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.insert() `. + + .. _basic_text_buffer_replace: + .. py:method:: replace(number_string: int, message: str) Replaces a specific string in a Text Buffer. If there is no such string, the method fills the list with empty strings up to the required position and *adds* the string. - :since: v0.4.0 + .. versionadded:: v0.4.0 + :param number_string: Position (number) of the string to be replaced (added) :type number_string: int :param message: A string that will replace the previous one by position :type message: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.replace() `. + + .. _basic_text_buffer_pop: + .. py:method:: pop([number_string: int = -1]) -> str Implements the saving of the generated dictionary strings to the csv file of the table. - :since: v0.6.0 + .. versionadded:: v0.6.0 + :param number_string: The string to be removed from the Text Buffer :type number_string: int :return: The specified string :rtype: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.pop() `. + + .. _basic_text_buffer_remove: + .. py:method:: remove(file_name: str) Deletes without returning the specified string from the Text Buffer. - :since: v0.6.0 + .. versionadded:: v0.6.0 + :param number_string: The string to be removed from the Text Buffer :type number_string: int + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.remove() `. + + .. _basic_text_buffer_clear: + .. py:method:: clear() Clears the entire Text Buffer, making it empty. - :since: v0.7.0 + .. versionadded:: v0.7.0 + + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.clear() `. + + .. _basic_text_buffer_save: .. py:method:: save(name_file: str, clean: bool) Saves the text of the Text Buffer to a file. - :since: v0.4.0 + .. versionadded:: v0.4.0 + :param name_file: The name of the file where the Text Buffer will be saved :type name_file: str :param clean: Saving should be done in Plain text (ignored with plain text environment)? :type clean: bool + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.save() `. + + .. _basic_text_buffer_load: + .. py:method:: load(name_file: str) Loads the text of the Text Buffer from a file. - :since: v0.7.0 + .. versionadded:: v0.7.0 + :param name_file: The name of the file from which to load the saved text of the Text Buffer :type name_file: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.load() `. + + .. _basic_text_buffer_input: + .. py:method:: input(input_text: str) -> str - A wrapper method for the standard Python input() that prepares the Text Buffer before using this function, and performs certain actions after, so that the Text Buffer can continue to function normally. + A wrapper method for the standard Python ``input()`` that prepares the Text Buffer before using this function, and performs certain actions after, so that the Text Buffer can continue to function normally. + + .. versionadded:: v0.7.0 - :since: v0.7.0 :param input_text: Displayed text on the screen that tells the user what to enter :type input_text: str :return: The string entered by the user :rtype: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.input() `. + + .. _basic_text_buffer_update_console: + .. py:method:: update_console(file_name: str) Refreshes the console, erasing output text and outputting an updated buffer. - :since: v0.5.0-dev + .. versionadded:: v0.5.0-dev + :raises NotImplementedError: Method append() is not implemented in the base class + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.update_console() `. + + .. _basic_text_buffer_update_entry: + .. py:method:: update_entry(file_name: str) Rewrites the last line of output after updating the last line of the buffer. Used (mostly) by the Progress bar (that is Progress string). - :since: v0.6.0 + .. versionadded:: v0.6.0 + :raises NotImplementedError: Method append() is not implemented in the base class + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.update_entry() `. + .. py:class:: TextBuffer(env: EnvironmentType[, console_width: int = 60]) A class with an advanced implementation of the console Text Buffer. It is not necessary to use it only in the console, but almost all methods are reimplemented for more complex algorithms, taking into account the width of the console (number of characters per line) and use ANSI escape codes that are only found in the console. - :since: v0.3.0 + .. versionadded:: v0.3.0 + + .. caution:: It was just a test feature that didn't work on the release yet and was completed by the next update v0.4.0. + + :param env: Text Buffer environment + :type env: EnvironmentType + :param console_width: Console width + :type console_width: int + + .. seealso:: + - Read the definition of the base class in :ref:`Type TextBufferType `. + + .. _text_buffer_append: .. py:method:: append(message: str) Adds a string to the end of the Text Buffer. - :since: v0.3.0 + .. versionadded:: v0.3.0 + + .. caution:: It was just a test feature that didn't work on the release yet and was completed by the next update v0.4.0. + :param message: The string to be added :type message: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.append() `. + + .. _text_buffer_insert: + .. py:method:: insert(number_string: int, message: str) Adds a string to the middle of the Text Buffer at the specified position. - :since: v0.4.0 + .. versionadded:: v0.4.0 + :param number_string: Position (number) of the line to which you need to add a string :type number_string: int :param message: The string to be placed on the position :type message: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.insert() `. + + .. _text_buffer_replace: + .. py:method:: replace(number_string: int, message: str) Replaces a specific string in a Text Buffer. If there is no such string, the method fills the list with empty strings up to the required position and *adds* the string. - :since: v0.3.0 + .. versionadded:: v0.3.0 + + .. caution:: It was just a test feature that didn't work on the release yet and was completed by the next update v0.4.0. + :param number_string: Position (number) of the string to be replaced (added) :type number_string: int :param message: A string that will replace the previous one by position :type message: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.replace() `. + + .. _text_buffer_pop: + .. py:method:: pop([number_string: int = -1]) -> str Implements the saving of the generated dictionary strings to the csv file of the table. - :since: v0.6.0 + .. versionadded:: v0.6.0 + :param number_string: The string to be removed from the Text Buffer :type number_string: int :return: The specified string :rtype: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.pop() `. + + .. _text_buffer_remove: + .. py:method:: remove(file_name: str) Deletes without returning the specified string from the Text Buffer. - :since: v0.6.0 + .. versionadded:: v0.6.0 + :param number_string: The string to be removed from the Text Buffer :type number_string: int + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.remove() `. + + .. _text_buffer_clear: + .. py:method:: clear() Clears the entire Text Buffer, making it empty. - :since: v0.7.0 + .. versionadded:: v0.7.0 + + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.clear() `. + + .. _text_buffer_save: .. py:method:: save(name_file: str, clean: bool) Saves the text of the Text Buffer to a file. - :since: v0.4.0 + .. versionadded:: v0.4.0 + :param name_file: The name of the file where the Text Buffer will be saved :type name_file: str :param clean: Saving should be done in Plain text (ignored with plain text environment)? :type clean: bool + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.save() `. + + .. _text_buffer_load: + .. py:method:: load(name_file: str) Loads the text of the Text Buffer from a file. - :since: v0.7.0 + .. versionadded:: v0.7.0 + :param name_file: The name of the file from which to load the saved text of the Text Buffer :type name_file: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.load() `. + + .. _text_buffer_input: + .. py:method:: input(input_text: str) -> str A wrapper method for the standard Python input() that prepares the Text Buffer before using this function, and performs certain actions after, so that the Text Buffer can continue to function normally. - :since: v0.7.0 + .. versionadded:: v0.7.0 + :param input_text: Displayed text on the screen that tells the user what to enter :type input_text: str :return: The string entered by the user :rtype: str + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.input() `. + + .. _text_buffer_update_console: + .. py:method:: update_console(file_name: str) Refreshes the console, erasing output text and outputting an updated buffer. - :since: v0.3.0 + .. versionadded:: v0.3.0 + + .. caution:: It was just a test feature that didn't work on the release yet and was completed by the next update v0.4.0. + + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.update_console() `. + + .. _text_buffer_update_entry: .. py:method:: update_entry(file_name: str) Rewrites the last line of output after updating the last line of the buffer. Used (mostly) by the Progress bar (that is Progress string). - :since: v0.6.0 + .. versionadded:: v0.6.0 + + .. seealso:: + - Read the basic method definition :ref:`TextBufferType.update_entry() `. diff --git a/docs/source/mighty_logger-class.rst b/docs/source/mighty_logger-class.rst new file mode 100644 index 0000000..bf5ed87 --- /dev/null +++ b/docs/source/mighty_logger-class.rst @@ -0,0 +1,480 @@ +Mighty Logger class +=================== + +.. hint:: To use, you need to enter + + .. code-block:: python + :linenos: + + from mighty_logger import MightyLogger + +Mighty Logger +------------- + +.. currentmodule:: mighty_logger.mighty_logger + +About class +___________ + +.. py:class:: MightyLogger(*[, program_name: str = "Unknown", log_environment: EnvironmentType = LogEnvironments.PLAIN, console_width: int = 60, icon_set: int = 1, global_bold_font: bool = False, global_italic_font: bool = False, global_invert_font: bool = False, global_background: bool = False]) + + The Logger class is a class that implements the functionality of logging the work of software in different directions. + + It has a color output of information, settings for the operation of the log. Only one class object can be created!!! + + Implements the output of the following information: + + 1. Logger entering time + 2. Entry category + 3. Entry type + 4. Entry message + + Implements the output of the following types of entries: + see the :ref:`Entry types `. + + .. versionadded:: 0.0.1 + + :param program_name: The name of the program being logged + :type program_name: str + :param log_environment: Mighty Logger environment + :type log_environment: EnvironmentType + :param console_width: Console width + :type console_width: int + :param icon_set: Icon set number + :type icon_set: int + :param global_bold_font: Sets the global setting "bold font" + :type global_bold_font: bool + :param global_italic_font: Sets the global setting "italic font" + :type global_italic_font: bool + :param global_invert_font: Sets the global setting "invert font" + :type global_invert_font: bool + :param global_background: Sets the global setting "background" + :type global_background: bool + + .. rubric:: Property + + .. property:: settings + + Dictionary of Logger's global settings. + + .. versionadded:: v0.9.3 + + :rtype: dict + + .. property:: buffer + + List of Logger entries from Buffer. + + .. versionadded:: v0.9.3 + + :rtype: list + + .. rubric:: Settings + + .. py:method:: _init_buffer(console_width: int) -> None + + Initializes a Text Buffer. + + .. versionadded:: 0.7.0 + + :param console_width: Console width + :type console_width: int + + .. py:method:: _initial_log() -> None + + Displays initialized information. + + .. versionadded:: 0.3.0 + + .. py:method:: set_icons(icon_set: int) -> None + + Changes the current icon set used by the Logger. + + .. versionadded:: 0.6.0 + + :param icon_set: Icon set to use + :type icon_set: int + + .. py:method:: set_settings(*[, global_bold_font: bool = None, global_italic_font: bool = None, global_invert_font: bool = None, global_background: bool = None]) -> None + + Method that sets new Logger settings. + + .. versionadded:: 0.9.2 + + :param global_bold_font: Sets the global setting "bold font" + :type global_bold_font: bool + :param global_italic_font: Sets the global setting "italic font" + :type global_italic_font: bool + :param global_invert_font: Sets the global setting "invert font" + :type global_invert_font: bool + :param global_background: Sets the global setting "background" + :type global_background: bool + + .. rubric:: Inputter of Logger + + .. py:method:: empty(entry: str) -> None + + Empty logging: A type denoting an "empty" entry - an entry that carries nothing but the purest text. + + It is an add-on for the Buffer append() method. + + .. versionadded:: 0.6.0 + + :param entry: "Empty" entry + :type entry: str + + .. py:method:: addy(number_string: int, message: str) -> None + + A method that adds the given string to the Logger Buffer at the given position. + + It is an add-on for the Buffer insert() method. + + .. versionadded:: 0.7.0 + + :param number_string: Position (number) of the line to which you need to add a string + :type number_string: int + :param message: The string to be placed on the position + :type message: str + + .. py:method:: modify(number_string: int, message: str) -> None + + A method that replaces the string at the given position in the Logger Buffer with the given string. + + It is an add-on for the Buffer replace() method. + + .. versionadded:: 0.7.0 + + :param number_string: Position (number) of the string to be replaced (added) + :type number_string: int + :param message: A string that will replace the previous one by position + :type message: str + + .. py:method:: catchy(number_string: int) -> str + + A method that extracts the given string from the Logger Buffer and returns. + + It is an add-on for the Buffer pop() method. + + .. versionadded:: 0.7.0 + + :param number_string: The string to be removed from the Text Buffer + :type number_string: int + :return: The specified string + :rtype: str + + .. py:method:: extractly(number_string: int) -> None + + A method that extracts the given string from the Logger Buffer without returning. + + It is an add-on for the Buffer remove() method. + + .. versionadded:: 0.7.0 + + :param number_string: The string to be removed from the Text Buffer + :type number_string: int + + .. py:method:: clearly() -> None + + A method that clears the entire Logger Buffer. + + It is an add-on for the Buffer clear() method. + + .. versionadded:: 0.7.0 + + :param console_width: Console width + :type console_width: int + + .. py:method:: savy(name_file: str, clean: bool) -> None + + A method that saves the Logger Buffer to a file. You can turn on formatting cleanup. + + It is an add-on for the Buffer save() method. + + .. versionadded:: 0.7.0 + + :param name_file: The name of the file where the Text Buffer will be saved + :type name_file: str + :param clean: Saving should be done in Plain text (ignored with plain text environment)? + :type clean: bool + + .. py:method:: loady(name_file: str) -> None + + A method that loads the Logger Buffer from a file. + + It is an add-on for the Buffer load() method. + + .. versionadded:: 0.7.0 + + :param name_file: The name of the file from which to load the saved text of the Text Buffer + :type name_file: str + + .. py:method:: getty(input_text: str) -> str + + A method that allows you to use the standard Python input() during the operation of the Logger, acting as its wrapper. + + It is an add-on for the Buffer input() method. + + .. versionadded:: 0.7.0 + + :param input_text: Displayed text on the screen that tells the user what to enter + :type input_text: str + :return: The string entered by the user + :rtype: str + + .. rubric:: Modifier of Logger + + .. py:method:: sort(key: SortingKeyType) -> None + + A method that sorts the Logger Buffer following the specified sort key. + + .. versionadded:: 0.7.1 + + :param key: The key to sort by + :type key: SortingKeyType + + .. py:method:: sort_with_save(key: SortingKeyType, sort_file_name: str) -> None + + A method that sorts the Logger Buffer following the specified sort key and saves it to a file. After saving, the Buffer is restored. + + .. versionadded:: 0.7.1 + + :param key: The key to sort by + :type key: SortingKeyType + :param sort_file_name: The name of the file where you want to save the sorted Logs + :type sort_file_name: str + + .. py:method:: search(keyword: str, empty: bool) -> None + + A method that searches the Logger Buffer for a given words/letters/phrases. You can also enable the search for "empty" strings. + + .. versionadded:: 0.7.1 + + :param keyword: Words/letters/phrases + :type keyword: str + :param empty: Flag indicating whether to search in custom strings + :type empty: bool + + .. py:method:: search_with_save(keyword: str, empty: bool, search_file_name: str) -> None + + A method that searches the Logger Buffer for a given words/letters/phrases. You can also enable the search for "empty" strings. The found strings are saved to a file. After saving, the Buffer is restored. + + .. versionadded:: 0.7.1 + + :param keyword: Words/letters/phrases + :type keyword: str + :param empty: Flag indicating whether to search in custom strings + :type empty: bool + :param search_file_name: The name of the file where you want to save the searched Logs + :type search_file_name: str + + .. py:method:: select(entry_type: EntryType) -> None + + A method that selects entries in the Logger Buffer with the specified category or type. + + .. versionadded:: 0.7.1 + + :param entry_type: Entries type/category + :type entry_type: EntryType + + .. py:method:: select_with_save(entry_type: EntryType, select_file_name: str) -> None + + A method that selects entries in the Logger Buffer with the specified category or type and saves them to a file. After saving, the Buffer is restored. + + .. versionadded:: 0.7.1 + + :param entry_type: Entries type/category + :type entry_type: EntryType + :param select_file_name: The name of the file where you want to save the selected Logs + :type select_file_name: str + + .. py:method:: export_to_csv(export_file_name: str) -> None + + Method that exports the Logger Buffer to a csv table. + + .. versionadded:: 0.8.0 + + :param export_file_name: The name of the file where you want to save the csv table + :type export_file_name: str + + .. rubric:: Publishers + + .. py:method:: publish_id() -> None + + A method that publishes information about the Logger ID in the Logger's Buffer. + + .. versionadded:: 0.7.0 + + .. py:method:: publish_program_name() -> None + + A method that publishes information about the name of the logging program in the Logger Buffer. + + .. versionadded:: 0.7.0 + + .. py:method:: publish_environment() -> None + + A method that publishes information about the Logger's environment to the Logger Buffer. + + .. versionadded:: 0.7.0 + + .. py:method:: publish_global_settings() -> None + + A method that publishes information about the Logger's global settings to the Logger Buffer. + + .. versionadded:: 0.7.0 + + .. py:method:: publish_author() -> None + + A method that publishes information about the Author of the library to the Logger Buffer. + + .. versionadded:: 0.7.0 + + .. py:method:: publish_license() -> None + + A method that publishes information about the Library's License to the Logger Buffer. + + .. versionadded:: 0.7.0 + + .. py:method:: separator() -> None + + A method that adds a separator. + + .. versionadded:: 0.7.0 + + .. rubric:: Entering to Logger + + .. py:method:: entry(entry_type: EntryType, message_text: str[, local_settings: dict = None]) -> None + + A method that generates and adds an entry to the Logger. + + .. versionadded:: 0.7.0 + + :param entry_type: Entry type + :type entry_type: EntryType + :param message_text: Log entry message + :type message_text: str + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. rubric:: Entering to Processes + + .. py:method:: start_indefinite_process(message_text: str[, animation: IndefiniteAnimationType = IndefiniteAnimations.Line, local_settings: dict = None]) -> None + + A method that starts the whole process of indefinite logging. While the process is running, you cannot start other processes in the Logger and call the entering methods directly. While the process is running - the last entry will play the animation of the process. Before starting a process, you can specify that the process Logs and configure Initiation and Progress entries. + + .. versionadded:: 0.6.0 + + :param message_text: Log entry message + :type message_text: str + :param animation: The name of the animation that will play in the Progress entry + :type animation: IndefiniteAnimationType + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: _indefinite_progress(message_text: str[, local_settings: dict = None]) -> None + + A method that creates an animation entry. Only works on the last string. You need to run in a thread. Terminates when the process stop flag is set by the Logger.stop_process() method. + + .. versionadded:: 0.6.0 + + :param message_text: Log entry message + :type message_text: str + :param local_background: Display entry with background? + :type local_background: bool + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: start_definite_process(message_text: str[, progress_bar: DefiniteAnimationType = DefiniteAnimations.Line, local_settings: dict = None]) -> None + + A method that starts the whole process of a definite logging. While the process is running, you cannot start other processes in the Logger and call the entering methods directly. While the process is running - the last entry will display the progress of the process. Before starting a process, you can specify that the process Logs and configure Initiation and Progress entries. + + .. versionadded:: 0.6.0 + + :param message_text: Log entry message + :type message_text: str + :param progress_bar: The name of the progress bar that will play in the Progress entry + :type progress_bar: DefiniteAnimationType + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: _definite_progress(message_text: str[, local_settings: dict = None]) -> None + + A method that creates a progress bar entry. Only works on the last string. You need to run in a thread. Terminates when the process stop flag is set by the Logger.stop_process() method. + + .. versionadded:: 0.6.0 + + :param message_text: Log entry message + :type message_text: str + :param local_background: Display entry with background? + :type local_background: bool + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: progress_rise(percent: int) -> None + + Sets the process completion percentage. Usually used for a specific process. However, it is used for both types of processes as a flag for the success of the process. If you set the percentage of completion to 100% before terminating the process, the process will complete successfully, otherwise it will fail. + + .. versionadded:: 0.6.0 + + :param percent: Process completion percentage + :type percent: int + + .. py:method:: note_process(entry_type: EntryType, message_text: str[, local_settings: dict = None]) -> None + + An important method that allows you to add standard non-process entry types while a process is running. It's important to note that this entry will still be associated with the process, so it's best to use this entry when you want to describe intermediate process execution entries beyond process initiation, progress, and success/failure entries. Adds the ability to use two additional entry types that cannot be used outside a process: achievement and milestone. + + Use ``from mighty_logger.src import LoggerEntryTypes`` or ``from mighty_logger.src import ProcessEntryTypes`` for ``entry_type``. + + .. versionadded:: 0.6.0 + + :param entry_type: The type of entry to be entered in the progress history + :type entry_type: EntryType + :param message_text: Log entry message + :type message_text: str + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: stop_process(message_text: str[, local_settings: dict = None]) -> None + + The method that terminates the process. If before the end of the process its execution has reached 100% - the process was completed successfully, otherwise - failed. After calling this method, the Progress entry will be replaced by the entry with the result of the process execution. + + .. versionadded:: 0.6.0 + + :param message_text: Log entry message + :type message_text: str + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. rubric:: Entering to Timer + + .. py:method:: start_timer(message_text: str[, local_settings: dict = None]) -> None + + Stores the current time as the start time and write entry about the current time. + + .. versionadded:: 0.6.1 + + :param message_text: Log entry message + :type message_text: str + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: timer_mark(message_text: str[, local_settings: dict = None]) -> None + + Calculates the difference between current and start time and write entry about the difference. + + .. versionadded:: 0.6.1 + + :param message_text: Log entry message + :type message_text: str + :param local_settings: Dictionary of local entering settings + :type local_settings: dict + + .. py:method:: stop_timer(message_text: str[, local_settings: dict = None]) -> None + + Calculates the difference between the current and start time, write entry about the difference, and resets the start time. + + .. versionadded:: 0.6.1 + + :param message_text: Log entry message + :type message_text: str + :param local_settings: Dictionary of local entering settings + :type local_settings: dict diff --git a/docs/source/mighty_logger-package.rst b/docs/source/mighty_logger-package.rst index f1822d5..0709ad8 100644 --- a/docs/source/mighty_logger-package.rst +++ b/docs/source/mighty_logger-package.rst @@ -1,14 +1,6 @@ "Mighty logger" package ======================= -.. toctree:: - :maxdepth: 2 - :caption: Contents: - :hidden: - - mighty_logger-basic-package - mighty_logger-src-package - A root package that provides access to a implementation of the powerful logger. .. versionadded:: 0.0.1 @@ -20,533 +12,10 @@ A root package that provides access to a implementation of the powerful logger. from mighty_logger.basic.lib_types import ... -.. currentmodule:: mighty_logger.mighty_logger - -.. rubric:: class MightyLogger -.. py:class:: MightyLogger(*[, program_name: str = "Unknown", log_environment: EnvironmentType = LogEnvironments.PLAIN, console_width: int = 60, icon_set: int = 1, global_bold_font: bool = False, global_italic_font: bool = False, global_invert_font: bool = False, global_background: bool = False]) - - The Logger class is a class that implements the functionality of logging the work of software in different directions. - - It has a color output of information, settings for the operation of the log. Only one class object can be created!!! - - Implements the output of the following information: - - 1. Record creation time - 2. Record status - 3. Recording status message - 4. Record type - 5. Write message - - Implements the output of the following types of records: - see the /docs/DATA.md/"Entry types" - - :since: v0.0.1 - - .. py:method:: _init_buffer(console_width: int) -> None - - Initializes a Text Buffer. - - :since: v0.7.0 - :param console_width: Console width - :type console_width: int - - .. py:method:: _initial_log() -> None - - Displays initialized information. - - :since: v0.3.0 - - .. py:method:: set_icons(icon_set: int) -> None - - Changes the current icon set used by the Logger. - - :since: v0.6.0 - :param icon_set: Icon set to use - :type icon_set: int - - .. py:method:: set_settings(*, global_bold_font: bool = None, global_italic_font: bool = None, global_invert_font: bool = None, global_background: bool = None) -> None - - Method that sets new Logger settings. - - :since: v0.9.2 - :param global_bold_font: Sets the global setting "bold font" - :type global_bold_font: bool - :param global_italic_font: Sets the global setting "italic font" - :type global_italic_font: bool - :param global_invert_font: Sets the global setting "invert font" - :type global_invert_font: bool - :param global_background: Sets the global setting "background" - :type global_background: bool - - .. py:method:: get_settings() -> dict - - Returns a dictionary of settings. - - :since: v0.9.2 - :return: A dictionary of settings - :rtype: dict - - .. py:method:: empty(entry: str) -> None - - Empty logging: A type denoting an "empty" entry - an entry that carries nothing but the purest text. - - :since: v0.6.0 - :param entry: "Empty" entry - :type entry: str - - .. py:method:: addy(number_string: int, message: str) -> None - - A method that adds the given string to the Logger Buffer at the given position. - - It is an add-on for the Buffer insert() method. - - :since: v0.7.0 - :param number_string: Position (number) of the line to which you need to add a string - :type number_string: int - :param message: The string to be placed on the position - :type message: str - - .. py:method:: modify(number_string: int, message: str)) -> None - - A method that replaces the string at the given position in the Logger Buffer with the given string. - - It is an add-on for the Buffer replace() method. - - :since: v0.7.0 - :param number_string: Position (number) of the string to be replaced (added) - :type number_string: int - :param message: A string that will replace the previous one by position - :type message: str - - .. py:method:: catchy(number_string: int) -> str - - A method that extracts the given string from the Logger Buffer and returns. - - It is an add-on for the Buffer pop() method. - - :since: v0.7.0 - :param number_string: The string to be removed from the Text Buffer - :type number_string: int - :return: The specified string - :rtype: str - - .. py:method:: extractly(number_string: int) -> None - - A method that extracts the given string from the Logger Buffer without returning. - - It is an add-on for the Buffer remove() method. - - :since: v0.7.0 - :param number_string: The string to be removed from the Text Buffer - :type number_string: int - - .. py:method:: clearly() -> None - - A method that clears the entire Logger Buffer. - - It is an add-on for the Buffer clear() method. - - :since: v0.7.0 - :param console_width: Console width - :type console_width: int - - .. py:method:: savy(name_file: str, clean: bool) -> None - - A method that saves the Logger Buffer to a file. You can turn on formatting cleanup. - - It is an add-on for the Buffer save() method. - - :since: v0.7.0 - :param name_file: The name of the file where the Text Buffer will be saved - :type name_file: str - :param clean: Saving should be done in Plain text (ignored with plain text environment)? - :type clean: bool - - .. py:method:: loady(name_file: str) -> None - - A method that loads the Logger Buffer from a file. - - It is an add-on for the Buffer load() method. - - :since: v0.7.0 - :param name_file: The name of the file from which to load the saved text of the Text Buffer - :type name_file: str - - .. py:method:: getty(input_text: str) -> str - - A method that allows you to use the standard Python input() during the operation of the Logger, acting as its wrapper. - - It is an add-on for the Buffer input() method. - - :since: v0.7.0 - :param input_text: Displayed text on the screen that tells the user what to enter - :type input_text: str - :return: The string entered by the user - :rtype: str - - .. py:method:: sort(key: SortingKeyType) -> None - - A method that sorts the Logger Buffer following the specified sort key. - - :since: v0.7.1 - :param key: The key to sort by - :type key: SortingKeyType - - .. py:method:: sort_with_save(key: SortingKeyType, sort_file_name: str) -> None - - A method that sorts the Logger Buffer following the specified sort key and saves it to a file. After saving, the Buffer is restored. - - :since: v0.7.1 - :param key: The key to sort by - :type key: SortingKeyType - :param sort_file_name: The name of the file where you want to save the sorted Logs - :type sort_file_name: str - - .. py:method:: search(keyword: str, empty: bool) -> None - - A method that searches the Logger Buffer for a given keyword/letter/phrase. You can also enable the search for "empty" strings. - - :since: v0.7.1 - :param keyword: Keyword/letter/phrase - :type keyword: str - :param empty: Flag indicating whether to search in custom strings - :type empty: bool - - .. py:method:: search_with_save(keyword: str, empty: bool, search_file_name: str) -> None - - A method that searches the Logger Buffer for a given keyword/letter/phrase. You can also enable the search for "empty" strings. The found strings are saved to a file. After saving, the Buffer is restored. - - :since: v0.7.1 - :param keyword: Keyword/letter/phrase - :type keyword: str - :param empty: Flag indicating whether to search in custom strings - :type empty: bool - :param search_file_name: The name of the file where you want to save the searched Logs - :type search_file_name: str - - .. py:method:: select(entry_type: EntryType) -> None - - A method that selects entries in the Logger Buffer with the specified category or type. - - :since: v0.7.1 - :param entry_type: Entries Type/Category - :type entry_type: EntryType - - .. py:method:: select_with_save(entry_type: EntryType, select_file_name: str) -> None - - A method that selects entries in the Logger Buffer with the specified category or type and saves them to a file. After saving, the Buffer is restored. - - :since: v0.7.1 - :param entry_type: Entries Type/Category - :type entry_type: EntryType - :param select_file_name: The name of the file where you want to save the selected Logs - :type select_file_name: str - - .. py:method:: export_to_csv(export_file_name: str) -> None - - Method that exports the Logger Buffer to a csv table. - - :since: v0.8.0 - :param export_file_name: The name of the file where you want to save the csv table - :type export_file_name: str - - .. py:method:: publish_id() -> None - - A method that publishes information about the Logger ID in the Logger's Buffer. - - :since: v0.7.0 - - .. py:method:: publish_program_name() -> None - - A method that publishes information about the name of the logging program in the Logger Buffer. - - :since: v0.7.0 - - .. py:method:: publish_environment() -> None - - A method that publishes information about the Logger's environment to the Logger Buffer. - - :since: v0.7.0 - - .. py:method:: publish_global_settings() -> None - - A method that publishes information about the Logger's global settings to the Logger Buffer. - - :since: v0.7.0 - - .. py:method:: publish_author() -> None - - A method that publishes information about the Author of the library to the Logger Buffer. - - :since: v0.7.0 - - .. py:method:: publish_license() -> None - - A method that publishes information about the Library's License to the Logger Buffer. - - :since: v0.7.0 - - .. py:method:: separator() -> None - - A method that adds a separator. - - :since: v0.7.0 - - .. py:method:: entry(entry_type: EntryType, message_text: str[, local_settings: dict = None]) -> None - - A method that generates and adds an entry to the Logger. - - :since: v0.7.0 - :param entry_type: Entry type - :type entry_type: EntryType - :param message_text: Log entry message - :type message_text: str - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: start_indefinite_process(message_text: str[, animation: IndefiniteAnimationType = IndefiniteAnimations.Line, local_settings: dict = None]) -> None - - A method that starts the whole process of indefinite logging. While the process is running, you cannot start other processes in the Logger and call the entering methods directly. While the process is running - the last entry will play the animation of the process. Before starting a process, you can specify that the process Logs and configure Initiation and Progress entries. - - :since: v0.6.0 - :param message_text: Log entry message - :type message_text: str - :param animation: The name of the animation that will play in the Progress entry - :type animation: IndefiniteAnimationType - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: _indefinite_progress(message_text: str[, local_settings: dict = None]) -> None - - A method that creates an animation entry. Only works on the last string. You need to run in a thread. Terminates when the process stop flag is set by the Logger.stop_process() method. - - :since: v0.6.0 - :param message_text: Log entry message - :type message_text: str - :param local_background: Display entry with background? - :type local_background: bool - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: start_definite_process(message_text: str[, progress_bar: DefiniteAnimationType = DefiniteAnimations.Line, local_settings: dict = None]) -> None - - A method that starts the whole process of a definite logging. While the process is running, you cannot start other processes in the Logger and call the entering methods directly. While the process is running - the last entry will display the progress of the process. Before starting a process, you can specify that the process Logs and configure Initiation and Progress entries. - - :since: v0.6.0 - :param message_text: Log entry message - :type message_text: str - :param progress_bar: The name of the progress bar that will play in the Progress entry - :type progress_bar: DefiniteAnimationType - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: _definite_progress(message_text: str[, local_settings: dict = None]) -> None - - A method that creates a progress bar entry. Only works on the last string. You need to run in a thread. Terminates when the process stop flag is set by the Logger.stop_process() method. - - :since: v0.6.0 - :param message_text: Log entry message - :type message_text: str - :param local_background: Display entry with background? - :type local_background: bool - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: progress_rise(percent: int) -> None - - Sets the process completion percentage. Usually used for a specific process. However, it is used for both types of processes as a flag for the success of the process. If you set the percentage of completion to 100% before terminating the process, the process will complete successfully, otherwise it will fail. - - :since: v0.6.0 - :param percent: Process completion percentage - :type percent: int - - .. py:method:: note_process(entry_type: EntryType, message_text: str[, local_settings: dict = None]) -> None - - An important method that allows you to add standard non-process entry types while a process is running. It's important to note that this entry will still be associated with the process, so it's best to use this entry when you want to describe intermediate process execution entries beyond process initiation, progress, and success/failure entries. Adds the ability to use two additional entry types that cannot be used outside a process: achievement and milestone. - - Use `from mighty_logger.src import LoggerEntryTypes` or `from mighty_logger.src import ProcessEntryTypes` for `entry_type`. - - :since: v0.6.0 - :param entry_type: The type of entry to be entered in the progress history - :type entry_type: EntryType - :param message_text: Log entry message - :type message_text: str - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: stop_process(message_text: str[, local_settings: dict = None]) -> None - - The method that terminates the process. If before the end of the process its execution has reached 100% - the process was completed successfully, otherwise - failed. After calling this method, the Progress entry will be replaced by the entry with the result of the process execution. - - :since: v0.6.0 - :param message_text: Log entry message - :type message_text: str - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: start_timer(message_text: str[, local_settings: dict = None]) -> None - - Stores the current time as the start time and write entry about the current time. - - :since: v0.6.1 - :param message_text: Log entry message - :type message_text: str - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: timer_mark(message_text: str[, local_settings: dict = None]) -> None - - Calculates the difference between current and start time and write entry about the difference. - - :since: v0.6.1 - :param message_text: Log entry message - :type message_text: str - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - - .. py:method:: stop_timer(message_text: str[, local_settings: dict = None]) -> None - - Calculates the difference between the current and start time, write entry about the difference, and resets the start time. - - :since: v0.6.1 - :param message_text: Log entry message - :type message_text: str - :param local_settings: Dictionary of local entering settings - :type local_settings: dict - -.. currentmodule:: mighty_logger.simple_logger - -.. rubric:: class Logger -.. py:class:: Logger(*[, program_name: str = "Unknown", log_environment: EnvironmentType = LogEnvironments.PLAIN, console_width: int = 60, icon_set: int = 1, global_bold_font: bool = False, global_italic_font: bool = False, global_invert_font: bool = False, global_background: bool = False]) - - Lightweight Logger automates work with entry types. - - :since: v0.7.0 - - .. py:method:: might() -> MightyLogger - - Provides access to "mighty" Logger methods. - - :since: v0.7.0 - :return: A "mighty" Logger - :rtype: MightyLogger - - .. py:method:: debug(message_text: str) -> None - - Debugging information logging: Can be used to log entry any information while debugging an application. - - :since: v0.0.1 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: debug_performance(message_text: str) -> None - - Performance debugging information logging: Can be used to log entry the execution time of operations or other performance information while the application is being debugged. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: performance(message_text: str) -> None - - Performance information logging: Can be used to log entry the execution time of operations or other application performance information. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: event(message_text: str) -> None - - Event information logging: Can be used to log entry specific events in the application, such as button presses or mouse cursor movements. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: audit(message_text: str) -> None - - Audit information logging: Can be used to log entry changes in the system, such as creating or deleting users, as well as changes in security settings. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: metrics(message_text: str) -> None - - Metrics information logging: Can be used to log entry metrics to track application performance and identify issues. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: user(message_text: str) -> None - - User information logging: Can be used to log entry custom logs to store additional information that may be useful for diagnosing problems. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: message(message_text: str) -> None - - Message information logging: Can be used for the usual output of ordinary messages about the program's operation. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: info(message_text: str) -> None - - Default information logging: Can be used to log entry messages with specific content about the operation of the program. - - :since: v0.0.1 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: notice(message_text: str) -> None - - Notice information logging: Can be used to flag important events that might be missed with a normal logging level. - - :since: v0.0.3 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: warning(message_text: str) -> None - - Warning information logging: Can be used to log entry warnings that the program may work with unpredictable results. - - :since: v0.0.1 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: error(message_text: str) -> None - - Error information logging: Used to log entry errors and crashes in the program. - - :since: v0.0.1 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: critical(message_text: str) -> None - - Critical error information logging: Used to log entry for critical and unpredictable program failures. - - :since: v0.0.1 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: success(message_text: str) -> None - - Success information logging: Used to log entry a message about the success of the process. - - :since: v0.0.2 - :param message_text: Log entry message - :type message_text: str - - .. py:method:: fail(message_text: str) -> None - - Fail information logging: Used to log entry a message about the failed execution of the process. +.. toctree:: + :maxdepth: 2 + :caption: Contents: - :since: v0.0.2 - :param message_text: Log entry message - :type message_text: str + logger-class + mighty_logger-basic-package + mighty_logger-src-package diff --git a/docs/source/mighty_logger-src-lib_types_collection-package.rst b/docs/source/mighty_logger-src-lib_types_collection-package.rst deleted file mode 100644 index bd3a000..0000000 --- a/docs/source/mighty_logger-src-lib_types_collection-package.rst +++ /dev/null @@ -1,486 +0,0 @@ -"lib types collection" package -============================== - -A package containing lists of prebuilt objects of library types. - -.. versionadded:: 0.7.1 - -.. hint:: To use, you need to enter - - .. code-block:: python - :linenos: - - from mighty_logger.src.lib_types_collection import ... - -.. currentmodule:: mighty_logger.src.lib_types_collection.entry_types - -.. rubric:: list ServiceLogger -.. py:class:: ServiceLogger - - .. danger:: This is a hidden class that is inaccessible outside the library. - - Class for Logger service strings. - - :since: v0.7.0 - - .. py:attribute:: initial - - Colors for the starting initialization string. - - :since: v0.7.0 - -.. rubric:: list LoggerEntryTypes -.. py:class:: LoggerEntryTypes - - .. tip:: Used in the entry() and note_process() methods. - - A class with standard entry types. Is available. - - :since: v0.7.0 - - .. py:attribute:: debug - - Debugging information logging: Can be used to log entry any information while debugging an application. - - :since: v0.6.0 - - .. py:attribute:: debug_performance - - Performance debugging information logging: Can be used to log entry the execution time of operations or other performance information while the application is being debugged. - - :since: v0.6.0 - - .. py:attribute:: performance - - Performance information logging: Can be used to log entry the execution time of operations or other application performance information. - - :since: v0.6.0 - - .. py:attribute:: event - - Event information logging: Can be used to log entry specific events in the application, such as button presses or mouse cursor movements. - - :since: v0.6.0 - - .. py:attribute:: audit - - Audit information logging: Can be used to log entry changes in the system, such as creating or deleting users, as well as changes in security settings. - - :since: v0.6.0 - - .. py:attribute:: metrics - - Metrics information logging: Can be used to log entry metrics to track application performance and identify issues. - - :since: v0.6.0 - - .. py:attribute:: user - - User information logging: Can be used to log entry custom logs to store additional information that may be useful for diagnosing problems. - - :since: v0.6.0 - - .. py:attribute:: message - - Message information logging: Can be used for the usual output of ordinary messages about the program's operation. - - :since: v0.6.0 - - .. py:attribute:: info - - Default information logging: Can be used to log entry messages with specific content about the operation of the program. - - :since: v0.6.0 - - .. py:attribute:: notice - - Notice information logging: Can be used to flag important events that might be missed with a normal logging level. - - :since: v0.6.0 - - .. py:attribute:: warning - - Warning information logging: Can be used to log entry warnings that the program may work with unpredictable results. - - :since: v0.6.0 - - .. py:attribute:: error - - Error information logging: Used to log entry errors and crashes in the program. - - :since: v0.6.0 - - .. py:attribute:: critical - - Critical error information logging: Used to log entry for critical and unpredictable program failures. - - :since: v0.6.0 - - .. py:attribute:: resolved - - Resolved information logging: Used to log entry resolved solutions to problems and errors. - - :since: v0.6.0 - - .. py:attribute:: unresolved - - Unresolved information logging: Used to log entry unresolved solutions to problems and errors. - - :since: v0.6.0 - -.. rubric:: list ProcessEntryTypes -.. py:class:: ProcessEntryTypes - - .. tip:: Used in the entry() and note_process() methods. - - Class with additional entry types when logging Processes. Is available. - - :since: v0.7.0 - - .. py:attribute:: achievement - - Achievement information logging: Used to log entry the achievements gained while executing a process. - - :since: v0.6.0 - - .. py:attribute:: milestone - - Milestone information logging: Used to log entry the milestones gained while executing a process. - - :since: v0.6.0 - -.. rubric:: list ServiceProcessEntryTypes -.. py:class:: ServiceProcessEntryTypes - - .. danger:: This is a hidden class that is inaccessible outside the library. - - A class with utility types used for Process logging. Is not available. - - :since: v0.7.0 - - .. py:attribute:: initiation - - Initiation information logging: Used to explain the running process. - - :since: v0.7.0 - - .. py:attribute:: process - - Process information logging: Used to refine the progress of a Process. - - :since: v0.7.0 - - .. py:attribute:: success - - Success information logging: Used to log entry a message about the success of the process. - - :since: v0.7.0 - - .. py:attribute:: fail - - Fail information logging: Used to log entry a message about the failed execution of the process. - - :since: v0.7.0 - -.. rubric:: list ServiceTimerEntryTypes -.. py:class:: ServiceTimerEntryTypes - - .. danger:: This is a hidden class that is inaccessible outside the library. - - A class with utility types used for Timer logging. Is not available. - - :since: v0.7.0 - - .. py:attribute:: start_timer - - Information logging of starting Timer: Used to notify the start of the Timer. - - :since: v0.6.1 - - .. py:attribute:: timer_mark - - Information logging of mark Timer: Used to notify the mark of the Timer. - - :since: v0.6.1 - - .. py:attribute:: stop_timer - - Information logging of stopping Timer: Used to notify the stop of the Timer. - - :since: v0.6.1 - -.. rubric:: list SelectionTypes -.. py:class:: SelectionTypes - - .. tip:: Used in the select() and select_with_save() methods. - - A class with a list of all entry types. - Needed only for the select() method of the Modifier class. - - :since: v0.7.1 - - .. py:attribute:: debug - - Debugging information logging: Can be used to log entry any information while debugging an application. - - :since: v0.7.1 - - .. py:attribute:: debug_performance - - Performance debugging information logging: Can be used to log entry the execution time of operations or other performance information while the application is being debugged. - - :since: v0.7.1 - - .. py:attribute:: performance - - Performance information logging: Can be used to log entry the execution time of operations or other application performance information. - - :since: v0.7.1 - - .. py:attribute:: event - - Event information logging: Can be used to log entry specific events in the application, such as button presses or mouse cursor movements. - - :since: v0.7.1 - - .. py:attribute:: audit - - Audit information logging: Can be used to log entry changes in the system, such as creating or deleting users, as well as changes in security settings. - - :since: v0.7.1 - - .. py:attribute:: metrics - - Metrics information logging: Can be used to log entry metrics to track application performance and identify issues. - - :since: v0.7.1 - - .. py:attribute:: user - - User information logging: Can be used to log entry custom logs to store additional information that may be useful for diagnosing problems. - - :since: v0.7.1 - - .. py:attribute:: message - - Message information logging: Can be used for the usual output of ordinary messages about the program's operation. - - :since: v0.7.1 - - .. py:attribute:: info - - Default information logging: Can be used to log entry messages with specific content about the operation of the program. - - :since: v0.7.1 - - .. py:attribute:: notice - - Notice information logging: Can be used to flag important events that might be missed with a normal logging level. - - :since: v0.7.1 - - .. py:attribute:: warning - - Warning information logging: Can be used to log entry warnings that the program may work with unpredictable results. - - :since: v0.7.1 - - .. py:attribute:: error - - Error information logging: Used to log entry errors and crashes in the program. - - :since: v0.7.1 - - .. py:attribute:: critical - - Critical error information logging: Used to log entry for critical and unpredictable program failures. - - :since: v0.7.1 - - .. py:attribute:: resolved - - Resolved information logging: Used to log entry resolved solutions to problems and errors. - - :since: v0.7.1 - - .. py:attribute:: unresolved - - Unresolved information logging: Used to log entry unresolved solutions to problems and errors. - - :since: v0.7.1 - - .. py:attribute:: achievement - - Achievement information logging: Used to log entry the achievements gained while executing a process. - - :since: v0.7.1 - - .. py:attribute:: milestone - - Milestone information logging: Used to log entry the milestones gained while executing a process. - - :since: v0.7.1 - - .. py:attribute:: initiation - - Initiation information logging: Used to explain the running process. - - :since: v0.7.1 - - .. py:attribute:: process - - Process information logging: Used to refine the progress of a Process. - - :since: v0.7.1 - - .. py:attribute:: success - - Success information logging: Used to log entry a message about the success of the process. - - :since: v0.7.1 - - .. py:attribute:: fail - - Fail information logging: Used to log entry a message about the failed execution of the process. - - :since: v0.7.1 - - .. py:attribute:: start_timer - - Information logging of starting Timer: Used to notify the start of the Timer. - - :since: v0.7.1 - - .. py:attribute:: timer_mark - - Information logging of mark Timer: Used to notify the mark of the Timer. - - :since: v0.7.1 - - .. py:attribute:: stop_timer - - Information logging of stopping Timer: Used to notify the stop of the Timer. - - :since: v0.7.1 - -.. rubric:: list SelectionCategories -.. py:class:: SelectionCategories - - .. tip:: Used in the select() and select_with_save() methods. - - A class with a list of all entry categories. Needed only for the select() method of the Modifier class. - - :since: v0.7.2 - - .. py:attribute:: debug - - ... - - :since: v0.7.2 - - .. py:attribute:: event - - ... - - :since: v0.7.2 - - .. py:attribute:: message - - ... - - :since: v0.7.2 - - .. py:attribute:: error - - ... - - :since: v0.7.2 - - .. py:attribute:: process - - ... - - :since: v0.7.2 - - .. py:attribute:: timer - - ... - - :since: v0.7.2 - -.. currentmodule:: mighty_logger.src.lib_types_collection.environments - -.. rubric:: list LogEnvironments -.. py:class:: LogEnvironments - - .. tip:: Use for those methods, one of whose parameters is of type EnvironmentType. - - Environments of Logger. - - :since: v0.5.0-dev - - .. py:attribute:: CONSOLE - - ... - - :since: v0.5.0-dev - - .. py:attribute:: PLAIN_CONSOLE - - ... - - :since: v0.7.0 - - .. py:attribute:: HTML - - ... - - :since: v0.5.0-dev - - .. py:attribute:: MARKDOWN - - ... - - :since: v0.7.0 - - .. py:attribute:: PLAIN - - ... - - :since: v0.7.0 - -.. currentmodule:: mighty_logger.src.lib_types_collection.sorting_keys - -.. rubric:: list SortingKeys -.. py:class:: SortingKeys - - .. tip:: Used in the sort() and sort_with_save() methods. - - Sort keys. - - :since: v0.7.1 - - .. py:attribute:: SORT_ON_TIME - - ... - - :since: v0.7.1 - - .. py:attribute:: SORT_ON_TIME_WITH_REVERSE - - ... - - :since: v0.7.1 - - .. py:attribute:: SORT_ON_CATEGORY - - ... - - :since: v0.7.1 - - .. py:attribute:: SORT_ON_TYPE - - ... - - :since: v0.7.1 - diff --git a/docs/source/mighty_logger-src-package.rst b/docs/source/mighty_logger-src-package.rst index 87a0174..589513e 100644 --- a/docs/source/mighty_logger-src-package.rst +++ b/docs/source/mighty_logger-src-package.rst @@ -1,16 +1,9 @@ "src" package ============= -.. toctree:: - :maxdepth: 2 - :caption: Contents: - :hidden: - - mighty_logger-src-lib_types_collection-package - A package with the implementation of various data (ANSI, colors, etc.). -.. versionadded:: 0.2.0 +.. versionadded:: v0.2.0 .. hint:: To use, you need to enter @@ -19,248 +12,275 @@ A package with the implementation of various data (ANSI, colors, etc.). from mighty_logger.src import ... +Animations lists +---------------- + .. currentmodule:: mighty_logger.src.animations -.. rubric:: list IndefiniteAnimations +.. _list_of_animations: + +List of animations +__________________ + +.. seealso:: + - `The source of Animations `_ + .. py:class:: IndefiniteAnimations The class with sets indefinite animations. - :since: v0.6.0 + .. versionadded:: v0.6.0 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`IndefiniteAnimationType `. .. py:attribute:: Dots - ... + "Dots" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Wave - ... + "Wave" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: WaveAutoReverse - ... + "WaveAutoReverse" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Star - ... + "Star" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: StarAutoReverse - ... + "StarAutoReverse" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: StarHorizontalFill - ... + "StarHorizontalFill" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: StarHorizontalFillAutoReverse - ... + "StarHorizontalFillAutoReverse" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: Arrow - ... + "Arrow" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: ArrowAutoReverse - ... + "ArrowAutoReverse" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: Sunrise - ... + "Sunrise" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: Sunset - ... + "Sunset" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: SunriseSunset - ... + "SunriseSunset" animation. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: Clock1 - ... + "Clock1" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Clock2 - ... + "Clock2" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Clock3 - ... + "Clock3" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Circle - ... + "Circle" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: KnightRider - ... + "KnightRider" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: KnightRiderAutoReverse - ... + "KnightRiderAutoReverse" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Blocks1 - ... + "Blocks1" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Blocks2 - ... + "Blocks2" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Blocks3 - ... + "Blocks3" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Blocks4 - ... + "Blocks4" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: BlocksAutoReverse - ... + "BlocksAutoReverse" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Line - ... + "Line" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: LineAutoReverse - ... + "LineAutoReverse" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: BlockVerticalFill - ... + "BlockVerticalFill" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: BlockVerticalFillAutoReverse - ... + "BlockVerticalFillAutoReverse" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: BlockHorizontalFillAutoReverse - ... + "BlockHorizontalFillAutoReverse" animation. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: SuperSpace - ... + "SuperSpace" animation. + + .. versionadded:: v0.6.1 + +.. _list_of_progress_bars: - :since: v0.6.1 +List of progress bars +_____________________ -.. rubric:: list DefiniteAnimations .. py:class:: DefiniteAnimations The class with sets definite animations. - :since: v0.6.0 + .. versionadded:: v0.6.0 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`DefiniteAnimationType `. .. py:attribute:: Dots - ... + "Dots" progress bar. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Star - ... + "Star" progress bar. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: Arrow - ... + "Arrow" progress bar. - :since: v0.6.1 + .. versionadded:: v0.6.1 .. py:attribute:: KnightRider - ... + "KnightRider" progress bar. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: Line - ... + "Line" progress bar. - :since: v0.6.0 + .. versionadded:: v0.6.0 .. py:attribute:: BlockVerticalFill - ... + "BlockVerticalFill" progress bar. + + .. versionadded:: v0.6.0 - :since: v0.6.0 +ANSI Format +----------- .. currentmodule:: mighty_logger.src.ansi_format -.. rubric:: data AnsiFormat .. py:data:: AnsiFormat - ... + ANSI escape code dictionary. + + .. versionadded:: v0.2.0 + + .. danger:: This is a hidden data that is inaccessible outside the library. + + .. seealso:: + Source of inspiration: - :source: https://en.wikipedia.org/wiki/ANSI_escape_code - :since: v0.2.0 + - `ANSI escape code `_ + - `ANSI Escape Sequences `_ -.. rubric:: function _RecursiveGetAnsiFormat .. py:function:: _RecursiveGetAnsiFormat(ansi_address: str, ansi: dict) -> str Recursively extracts a string with an ANSI escape code from a heavily nested dictionary. - :since: v0.2.1 + .. versionadded:: v0.2.1 + :param ansi_address: Path to ANSI escape code value :type ansi_address: str :param ansi: External/nested dictionary @@ -268,18 +288,22 @@ A package with the implementation of various data (ANSI, colors, etc.). :return: value - ANSI escape code :rtype: str + .. danger:: This is a hidden function that is inaccessible outside the library. + .. rubric:: function GetAnsiFormat .. py:function:: GetAnsiFormat(ansi_address: str) -> str Returns the ANSI escape code value. - The following values are possible: see the list inREADME.md/Data/"Tree of ANSI escape code". + The following values are possible: see the list in :ref:`Tree of ANSI escape code `. An example of getting an ANSI escape code: .. code-block:: python :linenos: + from mighty_logger.src import GetAnsiFormat + print(f"{GetAnsiFormat('italic/fraktur')}Test string") print(f"{GetAnsiFormat('blink/slow')}Test string") print(f"{GetAnsiFormat('invert/off')}Test string") @@ -288,47 +312,55 @@ A package with the implementation of various data (ANSI, colors, etc.). print(f"{GetAnsiFormat('color/set/background/255;255;255')}Test string") print(f"{GetAnsiFormat('reset/on')}Test string") - :since: v0.2.1 + .. versionadded:: v0.2.1 + :param ansi_address: Path to ANSI escape code value :type ansi_address: str :return: ANSI escape code :rtype: str +Color picker +------------ + .. currentmodule:: mighty_logger.src.color_picker -.. rubric:: data ColorPicker .. py:data:: ColorPicker - Color table + Color table. + + .. versionadded:: v0.0.4 + + .. danger:: This is a hidden data that is inaccessible outside the library. - :source: https://en.wikipedia.org/wiki/Web_colors - :since: v0.0.4 + .. seealso:: + Source of inspiration: + + - `Web colors `_ -.. rubric:: function DecColor .. py:function:: DecColor(color_name: str) -> list[int, int, int] Returns a decimal color value. - :since: v0.0.4 + .. versionadded:: v0.0.4 + :param color_name: Color name :type color_name: str :return: Decimal color value :rtype: list[int, int, int] :raises ColorException: This color is not in the dictionary -.. rubric:: function HexColor .. py:function:: HexColor(color_name: str) -> str Returns a hexadecimal color value. - :since: v0.0.4 + .. versionadded:: v0.0.4 + :param color_name: Color name :type color_name: str :return: Hexadecimal color value :rtype: str :raises ColorException: This color is not in the dictionary -.. rubric:: function AnsiColor .. py:function:: AnsiColor(color_name: str, color_ground: str) -> str Returns an ANSI color value. In AnsiFormat, the following levels are available under the "color/set/..." path: @@ -339,7 +371,8 @@ A package with the implementation of various data (ANSI, colors, etc.). - bright background - underline - :since: v0.0.4 + .. versionadded:: v0.0.4 + :param color_name: Color name :type color_name: str :param color_ground: Color level @@ -348,23 +381,23 @@ A package with the implementation of various data (ANSI, colors, etc.). :rtype: str :raises ColorException: This color is not in the dictionary -.. rubric:: function Dec2Hex .. py:function:: Dec2Hex(dec_colors: list[int, int, int]) -> str Converts a decimal color value to a hexadecimal. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param dec_colors: Decimal color value :type dec_colors: list[int, int, int] :return: Hexadecimal color value :rtype: str -.. rubric:: function Dec2Ansi .. py:function:: Dec2Ansi(dec_colors: list[int, int, int], color_ground: str) -> str Converts a decimal color value to an ANSI escape code. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param dec_colors: Decimal color value :type dec_colors: list[int, int, int] :param color_ground: Color level (read AnsiColor() function documentation) @@ -372,23 +405,23 @@ A package with the implementation of various data (ANSI, colors, etc.). :return: ANSI escape code color value :rtype: str -.. rubric:: function Hex2Dec .. py:function:: Hex2Dec(hex_color: str) -> list[int, int, int] Converts a hexadecimal color value to a decimal. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param hex_color: Hexadecimal color value :type hex_color: str :return: Decimal color value :rtype: list[int, int, int] -.. rubric:: function Hex2Ansi .. py:function:: Hex2Ansi(hex_color: str, color_ground: str) -> str Converts a hexadecimal color value to an ANSI escape code. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param hex_color: Hexadecimal color value :type hex_color: str :param color_ground: Color level (read AnsiColor() function documentation) @@ -396,24 +429,551 @@ A package with the implementation of various data (ANSI, colors, etc.). :return: ANSI escape code color value :rtype: str -.. rubric:: function Ansi2Dec .. py:function:: Ansi2Dec(ansi_color: str) -> list[int, int, int] Converts an ANSI escape code color value to a decimal. When converting to ANSI escape code, you need to know which level the color is applied to, and when from ANSI escape code, you don’t need to, because in other formats the levels are defined differently and are not included in the command along with the color. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param ansi_color: ANSI escape code color value :type ansi_color: str :return: Decimal color value :rtype: list[int, int, int] -.. rubric:: function Ansi2Hex .. py:function:: Ansi2Hex(ansi_color: str) -> str Converts an ANSI escape code color value to a hexadecimal. When converting to ANSI escape code, you need to know which level the color is applied to, and when from ANSI escape code, you don’t need to, because in other formats the levels are defined differently and are not included in the command along with the color. - :since: v0.2.0 + .. versionadded:: v0.2.0 + :param ansi_color: ANSI escape code color value :type ansi_color: str :return: Hexadecimal color value :rtype: str + +.. _entry_types_collections: + +Entry types collections +----------------------- + +.. currentmodule:: mighty_logger.src.lib_types_collection.entry_types + +.. py:class:: ServiceLogger + + .. danger:: This is a hidden class that is inaccessible outside the library. + + Class for Logger service strings. + + .. versionadded:: v0.7.0 + + .. py:attribute:: initial + + Colors for the starting initialization string. + + .. versionadded:: v0.7.0 + +.. py:class:: LoggerEntryTypes + + .. tip:: Used in the ``entry()`` and ``note_process()`` methods. + + A class with standard entry types. Is available. + + .. versionadded:: v0.7.0 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EntryType `. + + .. py:attribute:: debug + + Debugging information logging: Can be used to log entry any information while debugging an application. + + .. versionadded:: v0.6.0 + + .. py:attribute:: debug_performance + + Performance debugging information logging: Can be used to log entry the execution time of operations or other performance information while the application is being debugged. + + .. versionadded:: v0.6.0 + + .. py:attribute:: performance + + Performance information logging: Can be used to log entry the execution time of operations or other application performance information. + + .. versionadded:: v0.6.0 + + .. py:attribute:: event + + Event information logging: Can be used to log entry specific events in the application, such as button presses or mouse cursor movements. + + .. versionadded:: v0.6.0 + + .. py:attribute:: audit + + Audit information logging: Can be used to log entry changes in the system, such as creating or deleting users, as well as changes in security settings. + + .. versionadded:: v0.6.0 + + .. py:attribute:: metrics + + Metrics information logging: Can be used to log entry metrics to track application performance and identify issues. + + .. versionadded:: v0.6.0 + + .. py:attribute:: user + + User information logging: Can be used to log entry custom logs to store additional information that may be useful for diagnosing problems. + + .. versionadded:: v0.6.0 + + .. py:attribute:: message + + Message information logging: Can be used for the usual output of ordinary messages about the program's operation. + + .. versionadded:: v0.6.0 + + .. py:attribute:: info + + Default information logging: Can be used to log entry messages with specific content about the operation of the program. + + .. versionadded:: v0.6.0 + + .. py:attribute:: notice + + Notice information logging: Can be used to flag important events that might be missed with a normal logging level. + + .. versionadded:: v0.6.0 + + .. py:attribute:: warning + + Warning information logging: Can be used to log entry warnings that the program may work with unpredictable results. + + .. versionadded:: v0.6.0 + + .. py:attribute:: error + + Error information logging: Used to log entry errors and crashes in the program. + + .. versionadded:: v0.6.0 + + .. py:attribute:: critical + + Critical error information logging: Used to log entry for critical and unpredictable program failures. + + .. versionadded:: v0.6.0 + + .. py:attribute:: resolved + + Resolved information logging: Used to log entry resolved solutions to problems and errors. + + .. versionadded:: v0.6.0 + + .. py:attribute:: unresolved + + Unresolved information logging: Used to log entry unresolved solutions to problems and errors. + + .. versionadded:: v0.6.0 + +.. py:class:: ProcessEntryTypes + + .. tip:: Used in the ``note_process()`` methods. + + Class with additional entry types when logging Processes. Is available. + + .. versionadded:: v0.7.0 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EntryType `. + + .. py:attribute:: achievement + + Achievement information logging: Used to log entry the achievements gained while executing a process. + + .. versionadded:: v0.6.0 + + .. py:attribute:: milestone + + Milestone information logging: Used to log entry the milestones gained while executing a process. + + .. versionadded:: v0.6.0 + +.. py:class:: ServiceProcessEntryTypes + + .. danger:: This is a hidden class that is inaccessible outside the library. + + A class with utility types used for Process logging. Is not available. + + .. versionadded:: v0.7.0 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EntryType `. + + .. py:attribute:: initiation + + Initiation information logging: Used to explain the running process. + + .. versionadded:: v0.7.0 + + .. py:attribute:: process + + Process information logging: Used to refine the progress of a Process. + + .. versionadded:: v0.7.0 + + .. py:attribute:: success + + Success information logging: Used to log entry a message about the success of the process. + + .. versionadded:: v0.7.0 + + .. py:attribute:: fail + + Fail information logging: Used to log entry a message about the failed execution of the process. + + .. versionadded:: v0.7.0 + +.. py:class:: ServiceTimerEntryTypes + + .. danger:: This is a hidden class that is inaccessible outside the library. + + A class with utility types used for Timer logging. Is not available. + + .. versionadded:: v0.7.0 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EntryType `. + + .. py:attribute:: start_timer + + Information logging of starting Timer: Used to notify the start of the Timer. + + .. versionadded:: v0.6.1 + + .. py:attribute:: timer_mark + + Information logging of mark Timer: Used to notify the mark of the Timer. + + .. versionadded:: v0.6.1 + + .. py:attribute:: stop_timer + + Information logging of stopping Timer: Used to notify the stop of the Timer. + + .. versionadded:: v0.6.1 + +.. py:class:: SelectionTypes + + .. tip:: Used in the ``select()`` and ``select_with_save()`` methods. + + A class with a list of all entry types. Needed only for the ``select()`` method of the Modifier class. + + .. versionadded:: v0.7.1 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EntryType `. + + .. py:attribute:: debug + + Debugging information logging: Can be used to log entry any information while debugging an application. + + .. versionadded:: v0.7.1 + + .. py:attribute:: debug_performance + + Performance debugging information logging: Can be used to log entry the execution time of operations or other performance information while the application is being debugged. + + .. versionadded:: v0.7.1 + + .. py:attribute:: performance + + Performance information logging: Can be used to log entry the execution time of operations or other application performance information. + + .. versionadded:: v0.7.1 + + .. py:attribute:: event + + Event information logging: Can be used to log entry specific events in the application, such as button presses or mouse cursor movements. + + .. versionadded:: v0.7.1 + + .. py:attribute:: audit + + Audit information logging: Can be used to log entry changes in the system, such as creating or deleting users, as well as changes in security settings. + + .. versionadded:: v0.7.1 + + .. py:attribute:: metrics + + Metrics information logging: Can be used to log entry metrics to track application performance and identify issues. + + .. versionadded:: v0.7.1 + + .. py:attribute:: user + + User information logging: Can be used to log entry custom logs to store additional information that may be useful for diagnosing problems. + + .. versionadded:: v0.7.1 + + .. py:attribute:: message + + Message information logging: Can be used for the usual output of ordinary messages about the program's operation. + + .. versionadded:: v0.7.1 + + .. py:attribute:: info + + Default information logging: Can be used to log entry messages with specific content about the operation of the program. + + .. versionadded:: v0.7.1 + + .. py:attribute:: notice + + Notice information logging: Can be used to flag important events that might be missed with a normal logging level. + + .. versionadded:: v0.7.1 + + .. py:attribute:: warning + + Warning information logging: Can be used to log entry warnings that the program may work with unpredictable results. + + .. versionadded:: v0.7.1 + + .. py:attribute:: error + + Error information logging: Used to log entry errors and crashes in the program. + + .. versionadded:: v0.7.1 + + .. py:attribute:: critical + + Critical error information logging: Used to log entry for critical and unpredictable program failures. + + .. versionadded:: v0.7.1 + + .. py:attribute:: resolved + + Resolved information logging: Used to log entry resolved solutions to problems and errors. + + .. versionadded:: v0.7.1 + + .. py:attribute:: unresolved + + Unresolved information logging: Used to log entry unresolved solutions to problems and errors. + + .. versionadded:: v0.7.1 + + .. py:attribute:: achievement + + Achievement information logging: Used to log entry the achievements gained while executing a process. + + .. versionadded:: v0.7.1 + + .. py:attribute:: milestone + + Milestone information logging: Used to log entry the milestones gained while executing a process. + + .. versionadded:: v0.7.1 + + .. py:attribute:: initiation + + Initiation information logging: Used to explain the running process. + + .. versionadded:: v0.7.1 + + .. py:attribute:: process + + Process information logging: Used to refine the progress of a Process. + + .. versionadded:: v0.7.1 + + .. py:attribute:: success + + Success information logging: Used to log entry a message about the success of the process. + + .. versionadded:: v0.7.1 + + .. py:attribute:: fail + + Fail information logging: Used to log entry a message about the failed execution of the process. + + .. versionadded:: v0.7.1 + + .. py:attribute:: start_timer + + Information logging of starting Timer: Used to notify the start of the Timer. + + .. versionadded:: v0.7.1 + + .. py:attribute:: timer_mark + + Information logging of mark Timer: Used to notify the mark of the Timer. + + .. versionadded:: v0.7.1 + + .. py:attribute:: stop_timer + + Information logging of stopping Timer: Used to notify the stop of the Timer. + + .. versionadded:: v0.7.1 + +.. py:class:: SelectionCategories + + .. tip:: Used in the ``select()`` and ``select_with_save()`` methods. + + A class with a list of all entry categories. Needed only for the ``select()`` method of the Modifier class. + + .. versionadded:: v0.7.2 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EntryType `. + + .. py:attribute:: debug + + Category "debug", which combines + + - debug + - debug_performance + - performance + + .. versionadded:: v0.7.2 + + .. py:attribute:: event + + Category "debug", which combines + + - event + - audit + - metrics + - user + + .. versionadded:: v0.7.2 + + .. py:attribute:: message + + Category "debug", which combines + + - message + - info + - notice + + .. versionadded:: v0.7.2 + + .. py:attribute:: error + + Category "debug", which combines + + - warning + - error + - critical + - resolved + - unresolved + + .. versionadded:: v0.7.2 + + .. py:attribute:: process + + Category "debug", which combines + + - achievement + - milestone + - initiation + - process + - success + - fail + + .. versionadded:: v0.7.2 + + .. py:attribute:: timer + + Category "debug", which combines + + - start_timer + - timer_mark + - stop_timer + + .. versionadded:: v0.7.2 + +.. _logger_environments_collections: + +Logger environments collections +------------------------------- + +.. currentmodule:: mighty_logger.src.lib_types_collection.environments + +.. py:class:: LogEnvironments + + .. tip:: Use for those methods, one of whose parameters is of type EnvironmentType. + + Environments of Logger. + + .. versionadded:: v0.5.0-dev + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`EnvironmentType `. + + .. py:attribute:: CONSOLE + + A "CONSOLE" environment that supports displaying logs in the console, updating/changing them WITH support for ANSI escape code (hence - with support for formatting text and changing its color foreground and background). + + .. versionadded:: v0.5.0-dev + + .. note:: In fact, appeared as an environment type, but actually existed as a separate class of the whole Logger, adapted for this environment from v0.2.0 before merging Loggers into one class and creating an environment type. + + .. py:attribute:: PLAIN_CONSOLE + + A "PLAIN_CONSOLE" environment that supports displaying logs in the console, updating/changing them WITHOUT ANSI escape code support. + + .. versionadded:: v0.7.0 + + .. py:attribute:: HTML + + An "HTML" environment that does NOT support displaying logs in the console, former text with HTML tags (with support for text formatting and changing colors) so that logs can be viewed in the Browser. + + .. versionadded:: v0.5.0-dev + + .. note:: In fact, appeared as an environment type, but actually existed as a separate class of the whole Logger, adapted for this environment from v0.0.1 before merging Loggers into one class and creating an environment type. + + .. py:attribute:: MARKDOWN + + A "MARKDOWN" environment that does NOT support displaying logs in the console, former text with HTML tags (with support for text formatting and changing colors) to allow viewing logs in note format. + + .. versionadded:: v0.7.0 + + .. py:attribute:: PLAIN + + A "PLAIN" environment, which does NOT support the display of logs in the console and WITHOUT the use of HTML tags, is the most lightweight and simple to work with pure text without unnecessary load on the system. + + .. versionadded:: v0.7.0 + +.. _sorting_keys_collections: + +Sorting keys collections +------------------------ + +.. currentmodule:: mighty_logger.src.lib_types_collection.sorting_keys + +.. py:class:: SortingKeys + + .. tip:: Used in the ``sort()`` ``and sort_with_save()`` methods. + + Sort keys. + + .. versionadded:: v0.7.1 + + .. hint:: Attributes are used to pass ready-made objects to fields of type :ref:`SortingKeyType `. + + .. py:attribute:: SORT_ON_TIME + + Sort by entry *time*. + + .. versionadded:: v0.7.1 + + .. py:attribute:: SORT_ON_TIME_WITH_REVERSE + + Sort by entry *time in reverse order*. + + .. versionadded:: v0.7.1 + + .. py:attribute:: SORT_ON_CATEGORY + + Sort by entry *category*. + + .. versionadded:: v0.7.1 + + .. py:attribute:: SORT_ON_TYPE + + Sort by entry *type*. + + .. versionadded:: v0.7.1