diff --git a/README.md b/README.md
index d451949..772d941 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,6 @@
- [Data](#data)
- [Entry types](#entry-types-)
- [X11 color table](#x11-color-table-)
- - [Default Color Scheme](#default-color-scheme-)
- [Logger Color Chart](#logger-color-chart-)
- [Tree of ANSI escape code](#tree-of-ansi-escape-code-)
- [Troubleshooting](#troubleshooting)
@@ -33,14 +32,14 @@ I often came across the opinion that it is better to use not standard output to
## Overview
The library implements the formation of a beautifully formatted colored text, similar to a log, which has all the necessary information:
-- Logging time
-- Name of device and profile that logged
-- Log status
-- Description of the log status
-- Log type
-- Log message
+- Device name and registered profile, system name, etc. (this data is displayed only once at the beginning of the logging)
+- Log entry time
+- Log entry status
+- Description of the log entry status
+- Log entry type
+- Entry message
-Any information to the output can be turned off (according to the standard, everything is included). It is also possible to change the output settings during the logging process. It is possible to change colors (class AnsiColorSetInit and HtmlColorSetInitQ).
+Any information to the output can be turned off (according to the standard, everything is included). It is also possible to change the output settings during the logging process. It is possible to change the colors of the foreground text and the background.
- [Content](#content)
@@ -73,23 +72,22 @@ pip install qt-colored-logger
```
## Usage in console
-The library has a complete [X11 color table](#x11-color-table-). However, logger use their [own color tables](#logger-color-chart-) for themselves, where the names of colors are determined not by its real physical name, but by a virtual one formed from the place where this color is used. These tables are initially empty. To initialize them, you need to create an object of the AnsiColorSetInit class, which, in addition to filling the table, provides methods for changing colors in the table. After that, you can already use the color table, and therefore you can start the logging process.
+The library has a complete [X11 color table](#x11-color-table-). However, logger use their [own color tables](#logger-color-chart-) for themselves, where the names of colors are determined not by its real physical name, but by a virtual one formed from the place where this color is used. These tables are initially empty and are initialized when the logger is created. Also, the logger provides the functionality of changing colors in color tables.
*Since the library is under active development, not the best solutions have been applied at this stage, which will be corrected in the future. But at the moment it is NOT RECOMMENDED to name an object of class Logger by the name log!*
-Logging is done by the LoggerQ class. To write to the log, you need to call a method with the desired entry type. There are 16 in total: [see section Data/"Entry types"](#entry-types-).
+Logging is done by the Logger class. To write to the log, you need to call a method with the desired entry type. There are 16 in total: [see section Data/"Entry types"](#entry-types-).
Not only the log itself has settings, but also each type of record. However, the log settings apply to all entries. Therefore, if you need to disable the output of a specific part of the record for a specific type of record, this must be done before each output of this record to the log (i.e., disable the output before writing and turn it back on after the output, so that this part of the information would be displayed for other types). This approach is used only if the part is disabled only for one or more data types.
-There are few settings for each entry type. There you can turn on/off only the text format bold/italic/standard. Also, do not forget to pass the status text (if enabled) and the message text (if enabled) to the record, since the developer himself determines the data to be recorded.
+There are few settings for each entry type. There you can turn on/off only the text format bold/italic/invert(does not support HTML)/background. Also, do not forget to pass the status text (if enabled) and the message text (if enabled) to the record, since the developer himself determines the data to be recorded.
Here is an example using the library:
```python
-from qt_colored_logger import AnsiColorSetInit, Logger
+from qt_colored_logger import Logger
if __name__ == '__main__':
- color = AnsiColorSetInit()
- logger = Logger(status_message=False)
+ logger = Logger(program_name="Test", status_message=False)
print(logger.DEBUG(message_text="Debug data"))
print(logger.DEBUG(message_text="Debug data", bold=True))
print(logger.DEBUG(message_text="Debug data", italic=True))
@@ -97,126 +95,129 @@ if __name__ == '__main__':
```
The outputs in console will contain the following text (GitHub, PyPi and possibly some other sites do not support displaying colors in Markdown - use resources that support them, such as PyCharm):
-> *2023-03-26 13:25:58.091911 $DESKTOP-NUMBER^User #STATUS: @DEBUG - Debug data
-> *2023-03-26 13:25:58.093911 $DESKTOP-NUMBER^User #STATUS: @DEBUG - Debug data
-> *2023-03-26 13:25:58.093911 $DESKTOP-NUMBER^User #STATUS: @DEBUG - Debug data
-> *2023-03-26 13:25:58.093911 $DESKTOP-NUMBER^User #STATUS: @DEBUG - Debug data
+> -Test?entry> $DESKTOP-8KG0R64^User@Windows:10.0.19045:64bit:WindowsPE:AMD64
+> -?entry> *2023-04-05 15:41:18.616238 #STATUS: %DEBUG - Debug data
+> -?entry> *2023-04-05 15:41:18.616238 #STATUS: %DEBUG - Debug data
+> -?entry> *2023-04-05 15:41:18.616238 #STATUS: %DEBUG - Debug data
+> -?entry> *2023-04-05 15:41:18.616238 #STATUS: %DEBUG - Debug data
-If you want to change the color of a part of a post, you need to refer to the [logger's color chart](#logger-color-chart-). The class Logger has read access, and AnsiColorSetInit has write access. As already mentioned, AnsiColorSetInit not only forms a table, but also provides methods for changing colors. The Logger Color Chart has the following color names: [see section Data/"Logger Color Chart"](#logger-color-chart-).
+If you want to change the color of a part of a post, you need to refer to the [logger's color chart](#logger-color-chart-). It contains a table of colors used by the logger. There are 6 colors for each type of record. Their values in the table can be changed by referring to a specific name. To do this, you need to pass the setColor() method (there is an additional setHexColor() in LoggerQ) the color name, the new color value, and the level flags. If you pass True to the foreground flag, the color of the foreground text with/without background will change, depending on the background flag. If background is set to False, the color of the front text will be changed without a background, and if True - with a background. If background is set to True and foreground is set to False - the background color will be set. Be careful - follow the names! It is quite possible to save the background color to the text color and the display may be completely broken. A False-False combination is not possible.
+
+| | Foreground level | Background level |
+|------------------|-------------------------|--------------------|
+| Text color | (..., True, False) | (..., True, True) |
+| Background color | ~~(..., False, False)~~ | (..., False, True) |
Here is an example of a color change:
```python
-from qt_colored_logger import AnsiColorSetInit, Logger
+from qt_colored_logger import Logger
if __name__ == '__main__':
- color = AnsiColorSetInit()
- logger = Logger(status_message=False)
+ logger = Logger(program_name="Test", status_message=False)
print(logger.NOTICE(message_text="Notice data"))
- color.setColor("NOTICE_MESSAGE", [127, 255, 0])
+ logger.set_color(logger_color_name="NOTICE_MESSAGE", color_value=[127, 255, 0], foreground=True, background=False)
print(logger.NOTICE(message_text="Notice data"))
```
The outputs in console will contain the following text (GitHub, PyPi and possibly some other sites do not support displaying colors in Markdown - use resources that support them, such as PyCharm):
-> *2023-03-26 13:52:29.519001 $DESKTOP-NUMBER^User #STATUS: @NOTICE - Notice data
-> *2023-03-26 13:52:29.519001 $DESKTOP-NUMBER^User #STATUS: @NOTICE - Notice data
+> -Test?entry> $DESKTOP-8KG0R64^User@Windows:10.0.19045:64bit:WindowsPE:AMD64
+> -?entry> *2023-04-05 17:09:39.103436 #STATUS: @NOTICE - Notice data
+> -?entry> *2023-04-05 17:09:39.103436 #STATUS: @NOTICE - Notice data
This is the simplest example of using the library:
```python
-from qt_colored_logger import AnsiColorSetInit, Logger
+from qt_colored_logger import Logger
if __name__ == "__main__":
- mod = AnsiColorSetInit()
- logger = Logger()
- print(logger.DEBUG("1", "2"))
- print(logger.DEBUG_PERFORMANCE("3", "4"))
- print(logger.PERFORMANCE("5", "6"))
- print(logger.EVENT("7", "8"))
- print(logger.AUDIT("9", "10"))
- print(logger.METRICS("11", "12"))
- print(logger.USER("13", "14"))
- print(logger.MESSAGE("15", "16"))
- print(logger.INFO("17", "18"))
- print(logger.NOTICE("19", "20"))
- print(logger.WARNING("21", "22"))
- print(logger.ERROR("23", "24"))
- print(logger.CRITICAL("25", "26"))
- # print(logger.START_PROCESS("27", "28"))
- print(logger.SUCCESS("29", "30"))
- print(logger.FAIL("31", "32"))
+ logger = Logger(program_name="Test")
+ print(logger.DEBUG(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.DEBUG_PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.EVENT(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.AUDIT(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.METRICS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.USER(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.MESSAGE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.INFO(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.NOTICE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.WARNING(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.ERROR(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.CRITICAL(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ # print(logger.START_PROCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.SUCCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ print(logger.FAIL(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
```
The outputs in console will contain the following text (GitHub, PyPi and possibly some other sites do not support displaying colors in Markdown - use resources that support them, such as PyCharm):
-> *2023-03-26 13:54:25.837031 $DESKTOP-NUMBER^User #STATUS: 1 @DEBUG - 2
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 3 @DEBUG PERFORMANCE - 4
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 5 @PERFORMANCE - 6
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 7 @EVENT - 8
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 9 @AUDIT - 10
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 11 @METRICS - 12
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 13 @USER - 14
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 15 @MESSAGE - 16
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 17 @INFO - 18
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 19 @NOTICE - 20
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 21 @WARNING - 22
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 23 !ERROR - 24
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 25 !!!@CRITICAL - 26
-> *2023-03-26 13:54:25.869034 $DESKTOP-NUMBER^User #STATUS: 29 @SUCCESS - 30
-> *2023-03-26 13:54:25.871033 $DESKTOP-NUMBER^User #STATUS: 31 @FAIL - 32
+> -Test?entry> $DESKTOP-8KG0R64^User@Windows:10.0.19045:64bit:WindowsPE:AMD64
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text %DEBUG - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text %DEBUG PERFORMANCE - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text %PERFORMANCE - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text ~EVENT - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text ~AUDIT - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text ~METRICS - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text ~USER - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text @MESSAGE - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text @INFO - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.365753 #STATUS: Test text @NOTICE - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.367751 #STATUS: Test text !WARNING - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.367751 #STATUS: Test text !!ERROR - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.367751 #STATUS: Test text !!!@CRITICAL - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.367751 #STATUS: Test text &SUCCESS - Test message Test message Test message Test message Test message
+> -?entry> *2023-04-05 17:17:48.367751 #STATUS: Test text &FAIL - Test message Test message Test message Test message Test message
## Usage in Qt
-Разница между консолью и Qt в том, что Qt использует HTML для отображения форматированого текста, а консоль - ANSI escape code. Однако к базовой логике доступ не планируется, а внешний интерфейс между классами AnsiColorSetInit/HtmlColorSetInitQ и Logger/LoggerQ не отличается (кроме самих названий классов). Поэтому все преддыдущие примеры можно переписать так:
+The difference between the console and Qt is that Qt uses HTML to display formatted text, while the console uses ANSI escape code. However, access to the basic logic is not planned, and the external interface between the Logger/LoggerQ classes is the same (except for the class names themselves). Therefore, all previous examples can be rewritten like this:
```python
-from qt_colored_logger import HtmlColorSetInitQ, LoggerQ
+from qt_colored_logger import LoggerQ
...
-self.color = HtmlColorSetInitQ()
-self.logger = LoggerQ(status_message=False)
-self.someTextBrowserObject.append(logger.DEBUG(message_text="Debug data"))
-self.someTextBrowserObject.append(logger.DEBUG(message_text="Debug data", bold=True))
-self.someTextBrowserObject.append(logger.DEBUG(message_text="Debug data", italic=True))
-self.someTextBrowserObject.append(logger.DEBUG(message_text="Debug data", bold=True, italic=True))
+self.logger = LoggerQ(program_name="Test", status_message=False)
+self.someTextBrowserObject.append(self.logger.DEBUG(message_text="Debug data"))
+self.someTextBrowserObject.append(self.logger.DEBUG(message_text="Debug data", bold=True))
+self.someTextBrowserObject.append(self.logger.DEBUG(message_text="Debug data", italic=True))
+self.someTextBrowserObject.append(self.logger.DEBUG(message_text="Debug data", bold=True, italic=True))
...
```
```python
-from qt_colored_logger import HtmlColorSetInitQ, LoggerQ
+from qt_colored_logger import LoggerQ
...
-color = HtmlColorSetInitQ()
-logger = LoggerQ(status_message=False)
-self.someTextBrowserObject.append(logger.NOTICE(message_text="Notice data"))
-color.setColor("NOTICE_MESSAGE", [127, 255, 0])
-self.someTextBrowserObject.append(logger.NOTICE(message_text="Notice data"))
+self.logger = LoggerQ(program_name="Test", status_message=False)
+self.someTextBrowserObject.append(self.logger.NOTICE(message_text="Notice data"))
+self.logger.set_color(logger_color_name="NOTICE_MESSAGE", color_value=[127, 255, 0], foreground=True, background=False)
+self.someTextBrowserObject.append(self.logger.NOTICE(message_text="Notice data"))
...
```
```python
-from qt_colored_logger import HtmlColorSetInitQ, LoggerQ
+from qt_colored_logger import LoggerQ
...
-mod = HtmlColorSetInitQ()
-logger = LoggerQ()
-self.someTextBrowserObject.append(logger.DEBUG("1", "2"))
-self.someTextBrowserObject.append(logger.DEBUG_PERFORMANCE("3", "4"))
-self.someTextBrowserObject.append(logger.PERFORMANCE("5", "6"))
-self.someTextBrowserObject.append(logger.EVENT("7", "8"))
-self.someTextBrowserObject.append(logger.AUDIT("9", "10"))
-self.someTextBrowserObject.append(logger.METRICS("11", "12"))
-self.someTextBrowserObject.append(logger.USER("13", "14"))
-self.someTextBrowserObject.append(logger.MESSAGE("15", "16"))
-self.someTextBrowserObject.append(logger.INFO("17", "18"))
-self.someTextBrowserObject.append(logger.NOTICE("19", "20"))
-self.someTextBrowserObject.append(logger.WARNING("21", "22"))
-self.someTextBrowserObject.append(logger.ERROR("23", "24"))
-self.someTextBrowserObject.append(logger.CRITICAL("25", "26"))
-# self.someTextBrowserObject.append(logger.START_PROCESS("27", "28"))
-self.someTextBrowserObject.append(logger.SUCCESS("29", "30"))
-self.someTextBrowserObject.append(logger.FAIL("31", "32"))
+self.logger = LoggerQ(program_name="Test")
+self.someTextBrowserObject.append(self.logger.DEBUG(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.DEBUG_PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.EVENT(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.AUDIT(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.METRICS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.USER(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.MESSAGE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.INFO(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.NOTICE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.WARNING(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.ERROR(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.CRITICAL(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+# self.someTextBrowserObject.append(logger.START_PROCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.SUCCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+self.someTextBrowserObject.append(self.logger.FAIL(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
...
```
@@ -400,78 +401,107 @@ The library stores various important data for use that you may need to know whil
- LIGHTGRAY
- GAINSBORO
-###### Default Color Scheme:
-- ORCHID
-- MEDIUMORCHID
-- ORANGE
-- DARKORANGE
-- BURLYWOOD
-- TAN
-- NAVAJOWHITE
-- WHEAT
-- BLANCHEDALMOND
-- BISQUE
-- MEDIUMSEAGREEN
-- SEAGREEN
-- YELLOWGREEN
-- OLIVEDRAB
-- OLIVE
-- DARKOLIVEGREEN
-- PALEGREEN
-- LIGHTGREEN
-- LIGHTSTEELBLUE
-- POWDERBLUE
-- PALETURQUOISE
-- LIGHTBLUE
-- DEEPSKYBLUE
-- DODGERBLUE
-- YELLOW
-- DARKYELLOW
-- FIREBRICK
-- DARKRED
-- MAROON
-- SKYBLUE
-- LIGHTSKYBLUE
-- GREEN
-- DARKGREEN
-
###### Logger Color Chart:
-- TIME
-- USER
-- STATUS
-- STATUS_MESSAGE
-- TYPE_DEBUG
-- DEBUG_MESSAGE
-- TYPE_DEBUG_PERFORMANCE
-- DEBUG_PERFORMANCE_MESSAGE
-- TYPE_PERFORMANCE
-- PERFORMANCE_MESSAGE
-- TYPE_EVENT
-- EVENT_MESSAGE
-- TYPE_AUDIT
-- AUDIT_MESSAGE
-- TYPE_METRICS
-- METRICS_MESSAGE
-- TYPE_USER
-- USER_MESSAGE
-- TYPE_MESSAGE
-- MESSAGE_MESSAGE
-- TYPE_INFO
-- INFO_MESSAGE
-- TYPE_NOTICE
-- NOTICE_MESSAGE
-- TYPE_WARNING
-- WARNING_MESSAGE
-- TYPE_ERROR
-- ERROR_MESSAGE
-- TYPE_CRITICAL
-- CRITICAL_MESSAGE
-- TYPE_PROGRESS
-- PROGRESS_MESSAGE
-- TYPE_SUCCESS
-- SUCCESS_MESSAGE
-- TYPE_FAIL
-- FAIL_MESSAGE
+| Color name | Foreground color | Background color |
+|-----------------------------------|-------------------|------------------|
+| INITIAL_COLOR | GOLD | INDIGO |
+| INITIAL_BACKGROUND | - | GOLD |
+| DEBUG_TIME | ORCHID | DARKMAGENTA |
+| DEBUG_STATUS | ORANGE | DARKRED |
+| DEBUG_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_DEBUG | BURLYWOOD | NAVY |
+| DEBUG_MESSAGE | TAN | MIDNIGHTBLUE |
+| DEBUG_BACKGROUND | - | TAN |
+| DEBUG_PERFORMANCE_TIME | ORCHID | DARKMAGENTA |
+| DEBUG_PERFORMANCE_STATUS | ORANGE | DARKRED |
+| DEBUG_PERFORMANCE_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_DEBUG_PERFORMANCE | NAVAJOWHITE | NAVY |
+| DEBUG_PERFORMANCE_MESSAGE | WHEAT | MIDNIGHTBLUE |
+| DEBUG_PERFORMANCE_BACKGROUND | - | WHEAT |
+| PERFORMANCE_TIME | ORCHID | DARKMAGENTA |
+| PERFORMANCE_STATUS | ORANGE | DARKRED |
+| PERFORMANCE_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_PERFORMANCE | BLANCHEDALMOND | NAVY |
+| PERFORMANCE_MESSAGE | BISQUE | MIDNIGHTBLUE |
+| PERFORMANCE_BACKGROUND | - | BISQUE |
+| EVENT_TIME | ORCHID | DARKMAGENTA |
+| EVENT_STATUS | ORANGE | DARKRED |
+| EVENT_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_EVENT | GREENYELLOW | NAVY |
+| EVENT_MESSAGE | YELLOWGREEN | MIDNIGHTBLUE |
+| EVENT_BACKGROUND | - | YELLOWGREEN |
+| AUDIT_TIME | ORCHID | DARKMAGENTA |
+| AUDIT_STATUS | ORANGE | DARKRED |
+| AUDIT_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_AUDIT | MEDIUMSPRINGGREEN | NAVY |
+| AUDIT_MESSAGE | SPRINGGREEN | MIDNIGHTBLUE |
+| AUDIT_BACKGROUND | - | SPRINGGREEN |
+| METRICS_TIME | ORCHID | DARKMAGENTA |
+| METRICS_STATUS | ORANGE | DARKRED |
+| METRICS_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_METRICS | PALEGREEN | NAVY |
+| METRICS_MESSAGE | LIGHTGREEN | MIDNIGHTBLUE |
+| METRICS_BACKGROUND | - | LIGHTGREEN |
+| USER_TIME | ORCHID | DARKMAGENTA |
+| USER_STATUS | ORANGE | DARKRED |
+| USER_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_USER | CHARTREUSE | NAVY |
+| USER_MESSAGE | LAWNGREEN | MIDNIGHTBLUE |
+| USER_BACKGROUND | - | LAWNGREEN |
+| MESSAGE_TIME | ORCHID | DARKMAGENTA |
+| MESSAGE_STATUS | ORANGE | DARKRED |
+| MESSAGE_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_MESSAGE | PALETURQUOISE | NAVY |
+| MESSAGE_MESSAGE | POWDERBLUE | MIDNIGHTBLUE |
+| MESSAGE_BACKGROUND | - | POWDERBLUE |
+| INFO_TIME | ORCHID | DARKMAGENTA |
+| INFO_STATUS | ORANGE | DARKRED |
+| INFO_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_INFO | LIGHTSKYBLUE | NAVY |
+| INFO_MESSAGE | SKYBLUE | MIDNIGHTBLUE |
+| INFO_BACKGROUND | - | SKYBLUE |
+| NOTICE_TIME | ORCHID | DARKMAGENTA |
+| NOTICE_STATUS | ORANGE | DARKRED |
+| NOTICE_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_NOTICE | LIGHTBLUE | NAVY |
+| NOTICE_MESSAGE | LIGHTSTEELBLUE | MIDNIGHTBLUE |
+| NOTICE_BACKGROUND | - | LIGHTSTEELBLUE |
+| WARNING_TIME | ORCHID | DARKMAGENTA |
+| WARNING_STATUS | ORANGE | DARKRED |
+| WARNING_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_WARNING | YELLOW | NAVY |
+| WARNING_MESSAGE | DARKYELLOW | MIDNIGHTBLUE |
+| WARNING_BACKGROUND | - | DARKYELLOW |
+| ERROR_TIME | ORCHID | PLUM |
+| ERROR_STATUS | ORANGE | ORANGE |
+| ERROR_STATUS_MESSAGE | DARKORANGE | DARKORANGE |
+| TYPE_ERROR | FIREBRICK | GAINSBORO |
+| ERROR_MESSAGE | DARKRED | LIGHTGRAY |
+| ERROR_BACKGROUND | - | DARKRED |
+| CRITICAL_TIME | ORCHID | PLUM |
+| CRITICAL_STATUS | ORANGE | ORANGE |
+| CRITICAL_STATUS_MESSAGE | DARKORANGE | DARKORANGE |
+| TYPE_CRITICAL | FIREBRICK | DARKSALMON |
+| CRITICAL_MESSAGE | DARKRED | LIGHTSALMON |
+| CRITICAL_BACKGROUND | - | MAROON |
+| PROGRESS_TIME | ORCHID | PURPLE |
+| PROGRESS_STATUS | ORANGE | DARKRED |
+| PROGRESS_STATUS_MESSAGE | DARKORANGE | MAROON |
+| TYPE_PROGRESS | LIGHTSKYBLUE | NAVY |
+| PROGRESS_MESSAGE | SKYBLUE | MIDNIGHTBLUE |
+| PROGRESS_BACKGROUND | - | SKYBLUE |
+| SUCCESS_TIME | ORCHID | LAVENDERBLUSH |
+| SUCCESS_STATUS | ORANGE | CHARTREUSE |
+| SUCCESS_STATUS_MESSAGE | DARKORANGE | LAWNGREEN |
+| TYPE_SUCCESS | GREEN | PALEGREEN |
+| SUCCESS_MESSAGE | DARKGREEN | LIGHTGREEN |
+| SUCCESS_BACKGROUND | - | DARKGREEN |
+| FAIL_TIME | ORCHID | LAVENDERBLUSH |
+| FAIL_STATUS | ORANGE | ORANGE |
+| FAIL_STATUS_MESSAGE | DARKORANGE | DARKORANGE |
+| TYPE_FAIL | FIREBRICK | YELLOW |
+| FAIL_MESSAGE | DARKRED | DARKYELLOW |
+| FAIL_BACKGROUND | - | DARKRED |
###### Tree of ANSI escape code:
- reset
diff --git a/qt_colored_logger/_basic/__init__.py b/qt_colored_logger/_basic/__init__.py
index c4aa173..415db6f 100644
--- a/qt_colored_logger/_basic/__init__.py
+++ b/qt_colored_logger/_basic/__init__.py
@@ -19,5 +19,5 @@
# ############################################################################ #
from ._basic_logger import _BasicLogger
-from ._exceptions import ColorException
+from ._exceptions import ColorException, CombinationException
from ._patterns import _Singleton
diff --git a/qt_colored_logger/_basic/_basic_logger.py b/qt_colored_logger/_basic/_basic_logger.py
index fc8651c..7b7937b 100644
--- a/qt_colored_logger/_basic/_basic_logger.py
+++ b/qt_colored_logger/_basic/_basic_logger.py
@@ -35,6 +35,7 @@ def __init__(
"""
Initializes and configures the log.
+ :param program_name: Installing the program name output
:param time: Setting the time output
:param name: Setting the name output
:param status: Setting the status output
@@ -49,30 +50,50 @@ def __init__(
self.status_type = status_type
self.message = message
self._ID = random.randint(1000000, 9999999)
+ self._pc_name = platform.node()
+ self._user_name = os.getlogin()
+ self._system_name = platform.system()
+ self._system_version = platform.version()
+ self._system_architecture = platform.architecture()
+ self._pc_machine = platform.machine()
- def _initial(self, colors: list[str, str]):
+ def _initialized_data(self, colors: list[str, str]) -> str:
+ """
+ A method that assemble an entry of system initialized data.
+ Forms a console string.
+
+ :param colors: Color string list of initialized data
+ :return: a string with initialized data
+ """
log = ""
log += f"{colors[1]}"
log += f"{colors[0]}-{self._program_name}?entry> "
- log += f"${platform.node()}^{os.getlogin()}"
- log += f"@{platform.system()}"
- log += f":{platform.version()}"
- log += f":{platform.architecture()[0]}"
- log += f":{platform.architecture()[1]}"
- log += f":{platform.machine()}"
+ log += f"${self._pc_name}^{self._user_name}"
+ log += f"@{self._system_name}"
+ log += f":{self._system_version}"
+ log += f":{self._system_architecture[0]}"
+ log += f":{self._system_architecture[1]}"
+ log += f":{self._pc_machine}"
log += f"{GetAnsiFormat('reset/on')}"
return log
- def _html_initial(self, colors: list[str, str]):
+ def _html_initialized_data(self, colors: list[str, str]) -> str:
+ """
+ A method that assemble an entry of system initialized data.
+ Forms an HTML string.
+
+ :param colors: Color string list of initialized data
+ :return: a string with initialized data
+ """
log = ""
log += f""
log += f"-{self._program_name}?entry> "
- log += f"${platform.node()}^{os.getlogin()}"
- log += f"@{platform.system()}"
- log += f":{platform.version()}"
- log += f":{platform.architecture()[0]}"
- log += f":{platform.architecture()[1]}"
- log += f":{platform.machine()}"
+ log += f"${self._pc_name}^{self._user_name}"
+ log += f"@{self._system_name}"
+ log += f":{self._system_version}"
+ log += f":{self._system_architecture[0]}"
+ log += f":{self._system_architecture[1]}"
+ log += f":{self._pc_machine}"
log += f""
return log
@@ -85,7 +106,7 @@ def _assemble_entry(
bold: bool,
italic: bool,
invert: bool,
- ):
+ ) -> str:
"""
A method that assemble an entry into a string and returns it.
Forms a console string.
@@ -121,7 +142,7 @@ def _assemble_html_entry(
message_text: str,
bold: bool,
italic: bool,
- ):
+ ) -> str:
"""
A method that assemble an entry into a string and returns it.
Forms an HTML string.
diff --git a/qt_colored_logger/_basic/_exceptions.py b/qt_colored_logger/_basic/_exceptions.py
index a99c602..4bef458 100644
--- a/qt_colored_logger/_basic/_exceptions.py
+++ b/qt_colored_logger/_basic/_exceptions.py
@@ -19,6 +19,19 @@
# ############################################################################ #
class ColorException(BaseException):
+ """
+ The exception that is thrown when there is no color in any palette.
+ """
+ def __init__(self, message):
+ self.message = message
+
+ def __str__(self):
+ return self.message
+
+class CombinationException(BaseException):
+ """
+ An exception that is used when composing impossible combinations of boolean flags.
+ """
def __init__(self, message):
self.message = message
diff --git a/qt_colored_logger/colored_logger.py b/qt_colored_logger/colored_logger.py
index 65f1988..4fc5e63 100644
--- a/qt_colored_logger/colored_logger.py
+++ b/qt_colored_logger/colored_logger.py
@@ -18,23 +18,22 @@
# ---------------------------------------------------------------------------- #
# ############################################################################ #
-from qt_colored_logger._basic import _Singleton, _BasicLogger, ColorException
+from qt_colored_logger._basic import _Singleton, _BasicLogger, ColorException, CombinationException
from qt_colored_logger.src import AnsiColor, Dec2Ansi
class Logger(_Singleton, _BasicLogger):
"""
The Logger class is a class that implements the functionality
- of logging the work of software in different directions.
+ of logging the work of software in different directions.\n
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:
+ Only one class object can be created!!!\n
+ Implements the output of the following information:\n
1) Record creation time;
- 2) Recording device;
- 3) Record status;
- 4) Recording status message;
- 5) Record type;
- 6) Write message.
- Implements the output of the following types of records:
+ 2) Record status;
+ 3) Recording status message;
+ 4) Record type;
+ 5) Write message.
+ \nImplements the output of the following types of records:\n
1) `DEBUG`
2) `DEBUG_PERFORMANCE`
3) `PERFORMANCE`
@@ -68,7 +67,7 @@ def __init__(
self._AnsiColorSet: dict = {}
self._ansi_color_set_init()
self.global_background = global_background
- print(self._initial_log())
+ print(self._initial_log()) # todo Перенести в буфер
def _ansi_color_set_init(self):
"""
@@ -190,7 +189,10 @@ def _ansi_color_set_init(self):
self._AnsiColorSet['FAIL_BACKGROUND'] = ["", AnsiColor('DARKRED', "background")]
def _initial_log(self):
- return self._initial(
+ """
+ Displays initialized information.
+ """
+ return self._initialized_data( # todo return заменить на buffer
[
self._AnsiColorSet['INITIAL_COLOR'][self.global_background],
self._AnsiColorSet['INITIAL_BACKGROUND'][self.global_background]
@@ -201,9 +203,14 @@ def set_color(self, *, logger_color_name: str, color_value: list[int, int, int],
"""
A method that sets the ANSI escape code color code in the color table of the logger.
May throw a ColorException if the given color is not in the table.
- The logger color table stores the following keys: see README.md/Data/"Logger Color Chart".
-
- todo описать, как работают флаги foreground и background
+ The logger color table stores the following keys: see README.md/Data/"Logger Color Chart".\n
+ Boolean flags: If foreground is set to True, then the color of the foreground text will change
+ with/without a background (it all depends on the background flag). If in this case background
+ is set to False (the standard combination of arguments) - then the color of the specifically
+ front text that is displayed without a background changes, otherwise it changes the color
+ of the specifically front text that is displayed with a background. If the foreground is set
+ to False with background set to True, the background itself will change. The last combination,
+ when both arguments are False, is an impossible combination that throws a CombinationException.
:param logger_color_name: Color name in logger color table
:param color_value: Color value in RGB
@@ -215,23 +222,25 @@ def set_color(self, *, logger_color_name: str, color_value: list[int, int, int],
self._AnsiColorSet[logger_color_name][1] = Dec2Ansi(color_value, "background")
elif background and foreground:
self._AnsiColorSet[logger_color_name][1] = Dec2Ansi(color_value, "foreground")
- else:
+ elif not background and foreground:
self._AnsiColorSet[logger_color_name][0] = Dec2Ansi(color_value, "foreground")
+ else:
+ raise CombinationException("False-False combination of foreground-background flags not possible")
else:
raise ColorException("This color is not in the dictionary")
def DEBUG(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Debugging information logging:
- Can be used to record any information while debugging an application.
+ Can be used to log entry any information while debugging an application.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -248,16 +257,16 @@ def DEBUG(self, *, status_message_text: str = "...", message_text: str = "...",
def DEBUG_PERFORMANCE(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Performance debugging information logging:
- Can be used to record the execution time of operations or other
+ Can be used to log entry the execution time of operations or other
performance information while the application is being debugged.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -274,16 +283,16 @@ def DEBUG_PERFORMANCE(self, *, status_message_text: str = "...", message_text: s
def PERFORMANCE(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Performance information logging:
- Can be used to record the execution time of operations or
+ Can be used to log entry the execution time of operations or
other application performance information.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -300,16 +309,16 @@ def PERFORMANCE(self, *, status_message_text: str = "...", message_text: str = "
def EVENT(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Event information logging:
- Can be used to track specific events in the application,
+ Can be used to log entry specific events in the application,
such as button presses or mouse cursor movements.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -326,16 +335,16 @@ def EVENT(self, *, status_message_text: str = "...", message_text: str = "...",
def AUDIT(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Audit information logging:
- Can be used to track changes in the system, such as creating or
+ Can be used to log entry changes in the system, such as creating or
deleting users, as well as changes in security settings.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -352,15 +361,15 @@ def AUDIT(self, *, status_message_text: str = "...", message_text: str = "...",
def METRICS(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Metrics information logging:
- Can be used to log metrics to track application performance and identify issues.
+ Can be used to log entry metrics to track application performance and identify issues.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -377,16 +386,16 @@ def METRICS(self, *, status_message_text: str = "...", message_text: str = "..."
def USER(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
User information logging:
- Can be used to add custom logs to store additional information
+ Can be used to log entry custom logs to store additional information
that may be useful for diagnosing problems.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -405,13 +414,13 @@ def MESSAGE(self, *, status_message_text: str = "...", message_text: str = "..."
Message information logging:
Can be used for the usual output of ordinary messages about the program's operation.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -428,15 +437,15 @@ def MESSAGE(self, *, status_message_text: str = "...", message_text: str = "..."
def INFO(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = None) -> str:
"""
Default information logging:
- Can be used to display messages with specific content about the operation of the program.
+ Can be used to log entry messages with specific content about the operation of the program.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -455,13 +464,13 @@ def NOTICE(self, *, status_message_text: str = "...", message_text: str = "...",
Notice information logging:
Can be used to flag important events that might be missed with a normal logging level.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_entry(
@@ -478,15 +487,15 @@ def NOTICE(self, *, status_message_text: str = "...", message_text: str = "...",
def WARNING(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = True) -> str:
"""
Warning information logging:
- Can be used to display warnings that the program may work with unpredictable results.
+ Can be used to log entry warnings that the program may work with unpredictable results.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_entry(
[
@@ -502,15 +511,15 @@ def WARNING(self, *, status_message_text: str = "...", message_text: str = "..."
def ERROR(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, invert: bool = False, local_background: bool = True) -> str:
"""
Error information logging:
- Used to display errors and crashes in the program.
+ Used to log entry errors and crashes in the program.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_entry(
[
@@ -526,15 +535,15 @@ def ERROR(self, *, status_message_text: str = "...", message_text: str = "...",
def CRITICAL(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = True, italic: bool = False, invert: bool = False, local_background: bool = True) -> str:
"""
Critical error information logging:
- Used to display critical and unpredictable program failures.
+ Used to log entry for critical and unpredictable program failures.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_entry(
[
@@ -551,13 +560,13 @@ def START_PROCESS(self, *, status_message_text: str = "...", message_text: str =
"""
Stub.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
# return self._assemble_entry(
# [
@@ -576,13 +585,13 @@ def STOP_PROCESS(self, *, status_message_text: str = "...", message_text: str =
"""
Stub.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
pass
# Make transition to SUCCESS or FAIL
@@ -590,15 +599,15 @@ def STOP_PROCESS(self, *, status_message_text: str = "...", message_text: str =
def SUCCESS(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = True, invert: bool = False, local_background: bool = True) -> str:
"""
Success information logging:
- Used to display a message about the success of the process.
+ Used to log entry a message about the success of the process.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_entry(
[
@@ -614,15 +623,15 @@ def SUCCESS(self, *, status_message_text: str = "...", message_text: str = "..."
def FAIL(self, *, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = True, invert: bool = False, local_background: bool = True) -> str:
"""
Fail information logging:
- Used to display a message about the failed execution of the process.
+ Used to log entry a message about the failed execution of the process.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param invert: Display log in invert font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param invert: Display entry with invert font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_entry(
[
@@ -639,6 +648,14 @@ def FAIL(self, *, status_message_text: str = "...", message_text: str = "...", b
# Test
if __name__ == "__main__":
logger = Logger(program_name="WiretappingScaner")
+ print(logger.DEBUG(message_text="Debug data"))
+ print(logger.DEBUG(message_text="Debug data", bold=True))
+ print(logger.DEBUG(message_text="Debug data", italic=True))
+ print(logger.DEBUG(message_text="Debug data", bold=True, italic=True))
+
+
+
+
print(logger.DEBUG(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.DEBUG_PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
diff --git a/qt_colored_logger/html_colored_logger.py b/qt_colored_logger/html_colored_logger.py
index 6113c41..079e573 100644
--- a/qt_colored_logger/html_colored_logger.py
+++ b/qt_colored_logger/html_colored_logger.py
@@ -21,23 +21,22 @@
# The idea is taken here:
# https://github.com/Nakama3942/WiretappingScanner/commit/da5e0e71681b9e1462d5bba5438fc8b1fde8142e
-from qt_colored_logger._basic import _Singleton, _BasicLogger, ColorException
+from qt_colored_logger._basic import _Singleton, _BasicLogger, ColorException, CombinationException
from qt_colored_logger.src import HexColor, Dec2Hex
class LoggerQ(_Singleton, _BasicLogger):
"""
The LoggerQ class is a class that implements the functionality
- of logging the work of software in different directions.
+ of logging the work of software in different directions.\n
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:
+ Only one class object can be created!!!\n
+ Implements the output of the following information:\n
1) Record creation time;
- 2) Recording device;
- 3) Record status;
- 4) Recording status message;
- 5) Record type;
- 6) Recording message.
- Implements the output of the following types of records:
+ 2) Record status;
+ 3) Recording status message;
+ 4) Record type;
+ 5) Recording message.
+ \nImplements the output of the following types of records:\n
1) `DEBUG`
2) `DEBUG_PERFORMANCE`
3) `PERFORMANCE`
@@ -54,6 +53,7 @@ class LoggerQ(_Singleton, _BasicLogger):
14) `PROGRESS`
15) `SUCCESS`
16) `FAIL`
+ \nAttention: This class in the log entry does not support color inversion!
"""
def __init__(
@@ -71,7 +71,7 @@ def __init__(
self._HtmlColorSet: dict = {}
self._html_color_set_init()
self.global_background = global_background
- # print(self._initial_log())
+ # print(self._initial_log()) # todo Перенести в буфер
def _html_color_set_init(self):
"""
@@ -193,30 +193,28 @@ def _html_color_set_init(self):
self._HtmlColorSet['FAIL_BACKGROUND'] = ["", HexColor('DARKRED')]
def _initial_log(self):
- return self._html_initial(
+ """
+ Displays initialized information.
+ """
+ return self._html_initialized_data( # todo return заменить на buffer
[
self._HtmlColorSet['INITIAL_COLOR'][self.global_background],
self._HtmlColorSet['INITIAL_BACKGROUND'][self.global_background]
]
)
- def setHexColor(self, *, logger_color_name: str, hex_color_value: str, foreground: bool = True, background: bool = False):
+ def set_hex_color(self, *, logger_color_name: str, hex_color_value: str, foreground: bool = True, background: bool = False):
"""
A method that sets the hexadecimal color code in the color table of the logger.
May throw a ColorException if the given color is not in the table.
- The logger color table stores the following keys:
- `TIME, USER, STATUS, STATUS_MESSAGE, TYPE_DEBUG, DEBUG_MESSAGE, TYPE_DEBUG_PERFORMANCE,
- DEBUG_PERFORMANCE_MESSAGE, TYPE_PERFORMANCE, PERFORMANCE_MESSAGE, TYPE_EVENT, EVENT_MESSAGE,
- TYPE_AUDIT, AUDIT_MESSAGE, TYPE_METRICS, METRICS_MESSAGE, TYPE_USER, USER_MESSAGE,
- TYPE_MESSAGE, MESSAGE_MESSAGE, TYPE_INFO, INFO_MESSAGE, TYPE_NOTICE, NOTICE_MESSAGE,
- TYPE_WARNING, WARNING_MESSAGE, TYPE_ERROR, ERROR_MESSAGE, TYPE_CRITICAL, CRITICAL_MESSAGE,
- TYPE_PROGRESS, PROGRESS_MESSAGE, TYPE_SUCCESS, SUCCESS_MESSAGE, TYPE_FAIL, FAIL_MESSAGE.`
-
- A method that sets the ANSI escape code color code in the color table of the logger.
- May throw a ColorException if the given color is not in the table.
- The logger color table stores the following keys: see README.md/Data/"Logger Color Chart".
-
- todo описать, как работают флаги foreground и background
+ The logger color table stores the following keys: see README.md/Data/"Logger Color Chart".\n
+ Boolean flags: If foreground is set to True, then the color of the foreground text will change
+ with/without a background (it all depends on the background flag). If in this case background
+ is set to False (the standard combination of arguments) - then the color of the specifically
+ front text that is displayed without a background changes, otherwise it changes the color
+ of the specifically front text that is displayed with a background. If the foreground is set
+ to False with background set to True, the background itself will change. The last combination,
+ when both arguments are False, is an impossible combination that throws a CombinationException.
:param logger_color_name: Color name in logger color table
:param hex_color_value: Hexadecimal color value in logger color table
@@ -235,11 +233,16 @@ def setHexColor(self, *, logger_color_name: str, hex_color_value: str, foregroun
def set_color(self, *, logger_color_name: str, color_value: list[int, int, int], foreground: bool = True, background: bool = False):
"""
- A method that sets the ANSI escape code color code in the color table of the logger.
+ A method that sets the decimal RGB list color code in the color table of the logger.
May throw a ColorException if the given color is not in the table.
- The logger color table stores the following keys: see README.md/Data/"Logger Color Chart".
-
- todo описать, как работают флаги foreground и background
+ The logger color table stores the following keys: see README.md/Data/"Logger Color Chart".\n
+ Boolean flags: If foreground is set to True, then the color of the foreground text will change
+ with/without a background (it all depends on the background flag). If in this case background
+ is set to False (the standard combination of arguments) - then the color of the specifically
+ front text that is displayed without a background changes, otherwise it changes the color
+ of the specifically front text that is displayed with a background. If the foreground is set
+ to False with background set to True, the background itself will change. The last combination,
+ when both arguments are False, is an impossible combination that throws a CombinationException.
:param logger_color_name: Color name in logger color table
:param color_value: Color value in RGB
@@ -259,14 +262,14 @@ def set_color(self, *, logger_color_name: str, color_value: list[int, int, int],
def DEBUG(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Debugging information logging:
- Can be used to record any information while debugging an application.
+ Can be used to log entry any information while debugging an application.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -283,15 +286,15 @@ def DEBUG(self, status_message_text: str = "...", message_text: str = "...", bol
def DEBUG_PERFORMANCE(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Performance debugging information logging:
- Can be used to record the execution time of operations or other
+ Can be used to log entry the execution time of operations or other
performance information while the application is being debugged.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -308,15 +311,15 @@ def DEBUG_PERFORMANCE(self, status_message_text: str = "...", message_text: str
def PERFORMANCE(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Performance information logging:
- Can be used to record the execution time of operations or
+ Can be used to log entry the execution time of operations or
other application performance information.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -333,15 +336,15 @@ def PERFORMANCE(self, status_message_text: str = "...", message_text: str = "...
def EVENT(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Event information logging:
- Can be used to track specific events in the application,
+ Can be used to log entry specific events in the application,
such as button presses or mouse cursor movements.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -358,15 +361,15 @@ def EVENT(self, status_message_text: str = "...", message_text: str = "...", bol
def AUDIT(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Audit information logging:
- Can be used to track changes in the system, such as creating or
+ Can be used to log entry changes in the system, such as creating or
deleting users, as well as changes in security settings.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -383,14 +386,14 @@ def AUDIT(self, status_message_text: str = "...", message_text: str = "...", bol
def METRICS(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Metrics information logging:
- Can be used to log metrics to track application performance and identify issues.
+ Can be used to log entry metrics to track application performance and identify issues.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -407,15 +410,15 @@ def METRICS(self, status_message_text: str = "...", message_text: str = "...", b
def USER(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
User information logging:
- Can be used to add custom logs to store additional information
+ Can be used to log entry custom logs to store additional information
that may be useful for diagnosing problems.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -434,12 +437,12 @@ def MESSAGE(self, status_message_text: str = "...", message_text: str = "...", b
Message information logging:
Can be used for the usual output of ordinary messages about the program's operation.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -456,14 +459,14 @@ def MESSAGE(self, status_message_text: str = "...", message_text: str = "...", b
def INFO(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = None) -> str:
"""
Default information logging:
- Can be used to display messages with specific content about the operation of the program.
+ Can be used to log entry messages with specific content about the operation of the program.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -482,12 +485,12 @@ def NOTICE(self, status_message_text: str = "...", message_text: str = "...", bo
Notice information logging:
Can be used to flag important events that might be missed with a normal logging level.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
background = local_background if local_background is not None else self.global_background
return self._assemble_html_entry(
@@ -504,14 +507,14 @@ def NOTICE(self, status_message_text: str = "...", message_text: str = "...", bo
def WARNING(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = True) -> str:
"""
Warning information logging:
- Can be used to display warnings that the program may work with unpredictable results.
+ Can be used to log entry warnings that the program may work with unpredictable results.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_html_entry(
[
@@ -527,14 +530,14 @@ def WARNING(self, status_message_text: str = "...", message_text: str = "...", b
def ERROR(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = False, local_background: bool = True) -> str:
"""
Error information logging:
- Used to display errors and crashes in the program.
+ Used to log entry errors and crashes in the program.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_html_entry(
[
@@ -550,14 +553,14 @@ def ERROR(self, status_message_text: str = "...", message_text: str = "...", bol
def CRITICAL(self, status_message_text: str = "...", message_text: str = "...", bold: bool = True, italic: bool = False, local_background: bool = True) -> str:
"""
Critical error information logging:
- Used to display critical and unpredictable program failures.
+ Used to log entry for critical and unpredictable program failures.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_html_entry(
[
@@ -574,23 +577,23 @@ def START_PROCESS(self, status_message_text: str = "...", message_text: str = ".
"""
Stub.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
- """
- return self._assemble_html_entry(
- [
- self._HtmlColorSet['PROGRESS_TIME'][local_background],
- self._HtmlColorSet['PROGRESS_STATUS'][local_background],
- self._HtmlColorSet['PROGRESS_STATUS_MESSAGE'][local_background],
- self._HtmlColorSet['TYPE_PROGRESS'][local_background],
- self._HtmlColorSet['PROGRESS_MESSAGE'][local_background],
- self._HtmlColorSet['PROGRESS_BACKGROUND'][local_background],
- ], status_message_text, "&PROGRESS [*******.............] - 37%", message_text, bold, italic
- )
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
+ """
+ # return self._assemble_html_entry(
+ # [
+ # self._HtmlColorSet['PROGRESS_TIME'][local_background],
+ # self._HtmlColorSet['PROGRESS_STATUS'][local_background],
+ # self._HtmlColorSet['PROGRESS_STATUS_MESSAGE'][local_background],
+ # self._HtmlColorSet['TYPE_PROGRESS'][local_background],
+ # self._HtmlColorSet['PROGRESS_MESSAGE'][local_background],
+ # self._HtmlColorSet['PROGRESS_BACKGROUND'][local_background],
+ # ], status_message_text, "&PROGRESS [*******.............] - 37%", message_text, bold, italic
+ # )
pass
# Must run on a thread
@@ -598,12 +601,12 @@ def STOP_PROCESS(self, status_message_text: str = "...", message_text: str = "..
"""
Stub.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
pass
# Make transition to SUCCESS or FAIL
@@ -611,14 +614,14 @@ def STOP_PROCESS(self, status_message_text: str = "...", message_text: str = "..
def SUCCESS(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = True, local_background: bool = True) -> str:
"""
Success information logging:
- Used to display a message about the success of the process.
+ Used to log entry a message about the success of the process.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_html_entry(
[
@@ -634,14 +637,14 @@ def SUCCESS(self, status_message_text: str = "...", message_text: str = "...", b
def FAIL(self, status_message_text: str = "...", message_text: str = "...", bold: bool = False, italic: bool = True, local_background: bool = True) -> str:
"""
Fail information logging:
- Used to display a message about the failed execution of the process.
+ Used to log entry a message about the failed execution of the process.
- :param status_message_text: Log status message
- :param message_text: Log message
- :param bold: Display log in bold font?
- :param italic: Display log in italic font?
- :param local_background: Display log with background?
- :return: the generated log string
+ :param status_message_text: Log entry status message
+ :param message_text: Log entry message
+ :param bold: Display entry with bold font?
+ :param italic: Display entry with italic font?
+ :param local_background: Display entry with background?
+ :return: the generated log entry string
"""
return self._assemble_html_entry(
[
@@ -657,25 +660,25 @@ def FAIL(self, status_message_text: str = "...", message_text: str = "...", bold
# Test
if __name__ == "__main__":
- logger = LoggerQ(program_name="WiretappingScaner")
+ logger = LoggerQ(program_name="Test")
print(logger._initial_log())
print(logger.DEBUG(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.DEBUG_PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.PERFORMANCE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.EVENT(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
- logger.global_background = True
+ # logger.global_background = True
print(logger.AUDIT(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.METRICS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
- logger.time = False
+ # logger.time = False
print(logger.USER(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.MESSAGE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
- logger.status_type = False
+ # logger.status_type = False
print(logger.INFO(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.NOTICE(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.WARNING(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.ERROR(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.CRITICAL(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
- print(logger.START_PROCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
+ # print(logger.START_PROCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.SUCCESS(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
print(logger.FAIL(status_message_text="Test text", message_text="Test message Test message Test message Test message Test message"))
# print(logger.FAIL(status_message_text="33", message_text="34", invert=True))