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.
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 PickerModifierQ
).
!!!ATTEMPTION!!! At the moment, logging is implemented only in the form of HTML code for QTextBrowser for PyQt, since quite often I need to output the log not to the console, but to the program and save it to a file, including saving colors. Therefore, in this version, output to the console is not implemented, but only in QTextBrowser, however, in the next versions, a lot of functionality will be implemented for easy and convenient logging!
- Fixed some typos.
- Added new colors:
- OCEANBLUE;
- DARKOCEANBLUE;
- Changed color names:
- CYAN -> BLUE;
- DARKCYAN -> DARKBLUE;
- Added an ID to each logger class;
- Added new methods to the Logger class:
SUCCESS()
;FAIL()
;START_PROCESS()
; stub - not implementedSTOP_PROCESS()
; stub - not implemented
- Added some links to PyPi.
- The
LoggerQ
class is fully documented.
- Added new types of log output:
DEBUG_PERFORMANCE()
;PERFORMANCE()
;EVENT()
;AUDIT()
;METRICS()
;USER()
;MESSAGE()
;NOTICE()
;
- Added new colors:
- FIREBRICK replaced RED
- MEDIUMSPRINGGREEN
- SPRINGGREEN
- MEDIUMSEAGREEN
- SEAGREEN
- FORESTGREEN not used yet
- YELLOWGREEN
- OLIVEDRAB
- OLIVE
- DARKOLIVEGREEN
- AQUAMARINE replaced BLUE
- TURQUOISE replaced DARKBLUE
- SKYBLUE replaced OCEANBLUE
- LIGHTSKYBLUE replaced DARKOCEANBLUE
- BLUE Adopted its color according to the X11 standards table
- MEDIUMBLUE
- DARKBLUE Adopted its color according to the X11 standards table
- NAVY
- BLUEVIOLET replaced VIOLET
- DARKVIOLET Adopted its color according to the X11 standards table
- GAINSBORO
- LIGHTGREY
- SILVER
- DIMGREY
- Found and fixed several minor bugs.
- The
HtmlColorSetInitQ
class is fully documented; - Slightly fixed CHANGELOG.
- The color system has been completely redesigned (i.e. the system for working with colors);
- Added ALL X11 table colors from this page;
- Added functions for getting color values in different formats by their names;
- Added
ColorException
; - Started work with console logger (not yet available);
- Now only one object of the
HtmlColorSetInitQ
class can be created; - Now only one object of the
LoggerQ
class can be created; - The color table of the LoggerQ logger has been changed - now the table does not store color names, but abstract names:
- 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;
- Now, initially this table is not initialized and the logger will not be able to work. First you need to initialize the table by creating an object of the
HtmlColorSetInitQ
class, which also provides methods for changing this very logger color table.
- Implemented library functionality tests for early detection of minor bugs.
PickerModifierQ
class renamed toHtmlColorSetInitQ
.
- Fixed a bug that occurs when passing arguments to the
LoggerQ
constructor; - Fixed a bug due to which the color value was not correctly saved in the logger's color table when changing the color manually.
- Completed documentation of the library;
- Wrote the actual README (which corresponds to the current version).
- Slightly redefined colors in the logger;
- Changed the order of colors in the color table.
- Documented all new functionality;
- Fixed typos and outdated information in old documentation.
- Added a large dictionary of all ANSI escape codes and the
GetAnsi()
function to get it; - Fully implemented
AnsiColorSetInit
andLogger
classes based onHtmlColorSetInitQ
andLoggerQ
; Singleton
pattern used byHtmlColorSetInitQ
,LoggerQ
,AnsiColorSetInit
andLogger
moved to a separate class;- A base class has been created for
LoggerQ
andLogger
, which includes initialization, setting up loggers and generating entry strings (at the moment, inherited classes are used to simplify interaction with the base class and use ready-made functionality, but in the future their own functionality will be expanded); - The project structure has been completely changed (however, this only affects the development of the library and support for programs written with the version of the library v0.1.0 will remain, since the external attributes of communication with the library have not changed);
- Added the
DefaultColorScheme
list, which stores a list of all colors that are used in the color schemes of the loggers and theGetDefaultColorScheme()
function to get this list; - Now the
ColorPicker
dictionary stores only color values in RGB, and other formats are obtained by converting RGB; - Added functions
Dec2Hex()
,Dec2Ansi()
,Hex2Dec()
,Hex2Ansi()
,Ansi2Dec()
,Ansi2Hex()
, which are used to convert one color value format to another; - The logic of assembling strings logging entry's has been completely changed;
- The work of the
HtmlColorSetInitQ
andLoggerQ
classes is adjusted to the new best functionality that is used in the new classesAnsiColorSetInit
andLogger
.
- Optimized
HexColor()
andAnsiForegroundColor()
functions.
CodColor()
->AnsiForegroundColor()
.
- Fixed old calls to
Singleton
andBasicLogger
to new_Singleton
and_BasicLogger
inHtmlColorSetInitQ
,LoggerQ
,AnsiColorSetInit
andLogger
classes; - Fixed a bug in the
setColor()
method of the AnsiColorSetInit class, where the value of the new argument was not passed to theDec2Ansi()
function after changing theGetAnsiFormat()
function.
- Wrote the actual README (which takes into account changes in versions v0.2.0 and v0.2.1);
- Fixed a bug in the annotation of the
setColor()
method of theHtmlColorSetInitQ
class; - Changed the order of the changelog - now it goes in direct order from top to bottom (easy to read and understand), and not from bottom to top.
- For
GetAnsiFormat()
implemented the_RecursiveGetAnsiFormat()
helper function for it - nowGetAnsiFormat()
takes the path to the ANSI escape code value, recursively traverses the tree and returns the ANSI escape code value, which helps to make the code easier to understand and speed up development programs when using the library; here are some examples:
# Before
print(f"{AnsiFormat['color']['set']['background'].replace('$', '255;165;0')}Test string")
print(f"{AnsiFormat['reset']['on']}Test string")
# After
print(f"{GetAnsiFormat('color/set/background/255;255;255')}Test string")
print(f"{GetAnsiFormat('reset/on')}Test string")
- If earlier the
AnsiColor()
returned only the color of the text (the usual foreground), now you can specify any of the five plans (this is necessary for the next update, where I will add a change not only to the color, but also to the background of the logs):- foreground
- background
- bright foreground
- bright background
- underline
- Adapted the
Dec2Ansi()
andHex2Ansi()
functions to the modifiedAnsiColor()
; - The structure of the
qt_colored_logger/_basic
protected directory has been slightly changed.
- Protected the
qt_colored_logger/basic
directory - now it is calledqt_colored_logger/_basic
: you can still use its functionality, but now, according to the agreement, the IDE will issue a warning; remember - protected modules are designed only for use inside the library.
GetAnsi()
->GetAnsiFormat()
;AnsiForegroundColor()
->AnsiColor()
;- Changed names of keys in
AnsiFormat/font
dictionary from "1th alternative", "2th alternative" and "3th alternative" to "1st alternative", "2nd alternative" and "3rd alternative" respectively.
- Updated documentation;
- Wrote the actual README (which corresponds to the current version).
- Added support for inverting colors in entries (console);
- Added support for backgrounds in entries (console, HTML);
- Completely redesigned and written from scratch logger color table;
Logger
has includedAnsiColorSetInit
;LoggerQ
has includedHtmlColorSetInitQ
;- Removed list of default colors;
- Entry types categories defined:
- Debugging (%);
- Event (~);
- Message (@);
- Error (!);
- Process (&).
- Argument names are now required;
- Added an introductory line with system initialized information;
- Added a global enable background setting;
- Started work on the text buffer;
- Added new
CombinationException
.
- Split README, cutting DATA and APPLYING out of it;
- Published a plan for the next updates in README;
- Updated documentation;
- Wrote the actual README, DATA and APPLYING (which corresponds to the current version).
- Added a package
qt_colored_logger.text
; - Added
TextBuffer
(used for console) andBasicTextBuffer
(used with HTML) toqt_colored_logger.text
package; - Loggers moved from
qt_colored_logger
root package to nestedqt_colored_logger.logger
; - Entry methods rewritten - now they do not return strings of entries, but add them to the text buffer;
- Returned protected modules, making them fully available;
- Added blanks for the next updates;
- Reworked the principle of forming strings of entries in the
BasicLogger
, getting rid of the string variable; - Added
get_buffer()
method in loggers.
_html_initialized_data()
attached to_initialized_data()
;_assemble_html_entry()
attached to_assemble_entry()
;- Implemented
LogEnvironment
enumeration withConsole
andHTML
values; - The abstract class
TextBufferBase
is implemented as a type for buffers (it was necessary to combine two buffersBasicTextBuffer
andTextBuffer
); - The
Logger
class has been rewritten, by addingLoggerQ
functionality.
- The
LoggerQ
class is hidden.
- Updated annotation of modules and packages.
- Completed the
LogEnvironments
format and usage; - Accounted for environment in the
set_color()
function in the Logger class.
- Removed
LoggerQ
class and html_colored_logger.py module; - Removed the empty qt_colored_logger.logger package.
- Optimized the Logger class.
- The
TextBufferBase
class has been moved to theqt_colored_logger.basic
package in the new text_buffer_type.py module and renamed toTextBufferType
; - The colored_logger.py module has been renamed to powerful_logger.py and moved to the library root;
- Renamed the library to
mighty_logger
.
- Fixed TypeError in the
message()
method (because its name began to intersect with the setting responsible for displaying the message entry); - A bug of possible unpredictable behavior of the Logger has been fixed, since when creating the second object, a link to the existing one is returned, but
__init__()
is still called, and in case of switching to HTML format or changing other settings, unexpected behavior of the program could occur (just re-initialization of the class was excluded); - Fixed a bug in the
save()
method of theTextBufferType
class and inherited classes: the fact is thatTextBuffer
overrides the method with the addition of theclean
argument, which is not in the parent abstractTextBufferType
class - now it (the argument) is defined in all classes; - Fixed a bug when the buffer is created in advance: now there is a check if the buffer object exists; if it exists, the link is saved to the logger and a log is written that the buffer is borrowed, otherwise a new buffer is created.
- Updated documentation;
- Wrote the actual README, DATA and APPLYING (which corresponds to the current version).
- Added a new
ReCreationException
that is thrown when an object of a class inherited fromSingleton
is re-created; - The settings system has been completely changed.
- Renamed the repository to
mighty_logger
; - Translated the names of the entering methods from the Upper case format to the Lower case format.
- Removed line breaks in HTML, since Qt's
append()
method adds a line break on its own; this way lists of HTML entries will be displayed correctly in Qt (no unnecessary breaks), but when saving the file, you can choose whether to add line breaks between entries or not.
- Updated documentation;
- Wrote the actual README, DATA and APPLYING (which corresponds to the current version).
- Added 4 sets of icons for entries with the ability to create your own sets;
- Added template status messages with the ability to specify your own status message.
- Updated documentation;
- Wrote the actual README, DATA and APPLYING (which corresponds to the current version).
- Implemented Processes (an abstract concept that appears to be a new functionality):
- Added new entry types:
- Added new control methods:
Logger.start_indefinite_process()
- starts an indefinite Process;Logger.start_definite_process()
- starts a definite Process;Logger.progress_rise()
- sets the percentage of completion of the Process;Logger.note_process()
- adds an entry to the Process;Logger.stop_process()
- terminates the Process;
- Added animations for Processes;
- Added enum
TypesEntries
forLogger.note_process()
;
- Added extraction of strings from the buffer by the
pop()
method; - Beautifully decorated the code in the Logger class;
- Expanded icon set (for new entries).
- Fixed a bug where the percentage was changing just before adding a Process entry, and it was completely breaking the output (and a 0.01 second delay was enough to fix it);
- Fixed a bug that occurs when the last string in the console is removed, which occupies more than 1 line.
- Updated versioning;
- Updated documentation.
- Added new animations and worked out the old ones;
- Added a new category of types: Timer, and 3 entries for it:
start_timer()
;timer_mark()
;stop_timer()
.
- All entry types were merged into one
entry()
method, and all type differences were moved to theLoggerEntryTypes
(available),ProcessEntryTypes
(available),ServiceProcessEntryTypes
(not available),ServiceTimerEntryTypes
(not available) classes; - Due to the acquired complexity, a simplified version of the
Logger
was written -SimpleLogger
, where all the cut Logger methods, such asdebug
,message
, etc., were transferred; - Added new type
EnvironmentType
; - Added new Logger environments:
PLAIN_CONSOLE
;MARKDOWN
;PLAIN
;
- All types (classes) created for use within the library have been redefined from their original modules into the new
basic.lib_types
package; - Animations and Text buffers module moved to
src
package; - Added
EnvironmentException
andInitException
; - Buffer updated:
- Added Buffer input implementation (because after creating a Logger object, you can't use the standard Python
print()
,input()
and other functions that can affect console output when using theCONSOLE
environment and the newPLAIN_CONSOLE
) - now there is not only output in console, but also input (input()
method in Buffer); - Updated the
save()
method of the Text buffer (now theclean
argument is important for any environment, since the Buffer of Logger can store not only log entries, which allows theempty()
method, which is a standardprint()
in the library); - The implementation of the
remove()
method in the buffer is complete; - Added
clear()
andload()
methods; TextBufferType
is no longer an abstract class like other types-class;- Buffer development completed;
- Added Buffer input implementation (because after creating a Logger object, you can't use the standard Python
- Added methods-publishers in the Logger, which display certain information about the Logger in the logs:
publish_id()
publishes the generated Logger ID;publish_program_name()
publishes the name of the program whose work is being logged;publish_environment()
publishes the environment in which the Logger works;publish_global_settings()
publishes global Logger settings;publish_author()
publishes the author of the library;publish_license()
publishes a library license;separator()
adds a separator in the form of a line of eighty dashes;
- Added wrapper methods in Logger for Buffer methods:
Logger.addy()
5 -TextBufferType.insert()
;Logger.modify()
5 -TextBufferType.replace()
;Logger.catchy()
5 -TextBufferType.pop()
;Logger.extractly()
5 -TextBufferType.remove()
;Logger.clearly()
5 -TextBufferType.clear()
;Logger.savy()
5 -TextBufferType.save()
;Logger.loady()
5 -TextBufferType.load()
;Logger.getty()
5 -TextBufferType.input()
;
- Of the new wrapper and publisher methods, SimpleLogger implements:
SimpleLogger.print()
-Logger.empty()
;SimpleLogger.input()
-Logger.getty()
;SimpleLogger.save()
-Logger.savy()
;SimpleLogger.load()
-Logger.loady()
;SimpleLogger.separator()
-Logger.separator()
.
- Removed the ability to create custom icon sets (and removed the icon set module);
- The ability to change the color of entries has been removed (now it is impossible to change the color scheme at all due to the new improved data storage system for entry types);
- Removed emptied package
text
; - Removed
CombinationException
.
- Optimized buffer initialization.
- Added a new
Modifier
class with:- the
sort()
method for sorting logs by key; - the
search()
method to search for logs that contain a given string in the message; - the
select()
method for selecting logs by type; - the
entries
property, which returns a list;
- the
- Added a new type
SortingKeyType
; - Added a new list of keys
SortingKeys
for theModifier.sort()
method; - Added a new list of entry types
SelectionTypes
for theModifier.select()
method; - Added methods to
MightyLogger
that make it easier and more automated to work with the newModifier
class:sort()
;sort_with_save()
;search()
;search_with_save()
;select()
;select_with_save()
;
- Created a new package
src.lib_types_collection
and filled with modulesentry_types
,environments
,sorting_keys
,status_variables
.
- Removed methods:
Logger.print()
;Logger.input()
;Logger.save()
;Logger.load()
;Logger.separator()
.
- Reworked the signature of the
BasicLogger._assemble_entry()
method.
Logger
->MightyLogger
;SimpleLogger
->Logger
;Logger.get_logger()
->Logger.might()
;animation
->animations
.
- Added a new property to
EntryType
-type_category
; - Added a new list of entry categories
SelectionCategories
for theModifier.select()
method; - Now, depending on which list element is passed to
Modifier.select()
(SelectionTypes
orSelectionCategories
), this method will select entries either by types or by categories.
- The
powerful_logger
module has been renamed tomighty_logger
.
- Added new
Exporter
class with two methods:export_to_csv()
, which creates a list of dictionaries from a list of strings;save()
, which saves the list of dictionaries as a csv table;
- Added
export_to_csv()
method to Logger, which automates work with Exporter; - Added a new argument to
sort_with_save()
,search_with_save()
,select_with_save()
andexport_to_csv()
, through which you can set the name of the file where you want to save the modified/exported logs; - Moved the
text_buffer
module from the src package to the basic package and hid it from__init__
, since now there is no need to keep the Buffer object separately due to the presence of new methods in the Logger itself, which provide access to all Buffer methods and, partially, simplify and automate the work with the Buffer; - Added a new
MessageException
thrown by the entry builder (BasicLogger._assemble_entry()
) if the message length is less than 10 characters; - Now it is necessary to enter a message (longer than 10 characters), but it is not necessary to enter the name of the arguments;
- Due to the new search, sorting and selection algorithms, the presence of all parts of the entry is required, and therefore all settings that disable the output of any parts of the string have been removed.
- Any references and functionality about status messages are completely cut out from the entire library:
- Removed module
status_message_type
with nested type (class)StatusMessageType
; - Removed module
status_variables
with nested list ofStatusMessagePatterns
; - Arguments that accept a status message have been removed from all methods;
- In the entry builder (
BasicLogger._assemble_entry()
), the addition of a status message to the entry has been removed.
- Removed module
- Since both
Exporter
andModifier
divide the string according to certain patterns, I had to prohibit disabling any parts of the entry, otherwise the functionality of these classes becomes inoperative - it was originally designed for the full string (except the status message, which the author never used and decided to delete, as a rudimentary organ, because on the very first prototype, when the Logger was part of another project, it was the entry type that acted for the status message and no one knows why a separate status message was added...); - The system of importing standard library packages has been optimized, which will ease the load on RAM when the Logger is running.
- Renamed the
patterns
module tosingleton
and hidden from__init__
, since its use is supposed only inside the library by some classes.
On PyPi, it was tested and removed.
- Moved from
setup.py
topyproject.toml
; - Began to collect
wheel
.
- Updated documentation.
- Updated documentation.
- Made the
background
field a global setting; - Added the ability to change global settings and read them while the Logger is running;
- Added settings arguments to the "simple" Logger constructor;
- Hid the "mighty" Logger, but it can be used via the
might()
method; - Prohibited the creation of more than one "simple" Logger object, but "simple" and "mighty" Loggers can coexist, since "simple" uses "mighty" and is not inherited.
- Fixed a bug in the line builder in the PLAIN environment when processing the addition of the
#STATUS:
line - it was simply forgotten to remove the check for the removed condition.
- Moved the documentation from the code to the Web docs (now there is no documentation in the code, except for the
simple_logger
module); - README, APPLYING and DATA have been rewritten in INDEX, HOW TO USE and DATA;
- Added EXAMPLE and LICENSE;
- Rewrote the entire CHANGELOG to the new standard;
- Completed Web docs.
- Added
text_buffer
property toTextBufferType
; - Added
settings
andbuffer
properties toMightyLogger
; - Replaced the
might()
method with themight
property inLogger
; - Moved modules from
lib_types_collection
package tosrc
; - Arguments
program_name
andlog_environment
inMightyLogger
are now required; - Added redefinition of new operators in Text Buffers:
<
and>
; - Changed the behavior of old operators:
<
adds a string to the end of the file;>
extracts a string at the given number;<<
loads the Buffer from a file;>>
saves the Buffer to a file.
- Removed package
lib_types_collection
.
MightyLogger
,BasicTextBuffer
andTextBuffer
are now available outside the library again.
- Part of the checks in the Text Buffer moved from save/load methods to the constructor to immediately detect a mismatch between the type of environment and the type of Buffer, which leads to optimization of saving/loading and eliminating unexpected behavior when it is possible to use the Buffer with the wrong environment.
- Fixed all errors in the documentation;
- Added animations to examples;
- Documented new functionality and changes;
- Added TODO list.
- Added a new method for outputting the added string to the Buffer;
- Transferred percentages - now they are displayed not after the animation, but after the message of the entry (at the end of the string);
- Added a new entry type category:
AdditionalEntryTypes
:hint
;tip
;important
;attention
;caution
;danger
.
- Removing the initialization string is marked as deprecated method, but available for use.
- Adding an entry has been optimized - now after adding an entry to the Logger Buffer, instead of updating the entire output to the console, a new method is used that outputs a new string to the console, however, all other wrapper methods of the Logger over the Buffer continue to update the entire output;
- Optimized Modifier and Exporter.
Footnotes
-
Can be used not only in Processes, but also in a regular Logger ↩ ↩2 ↩3 ↩4 ↩5
-
Why such strange names were chosen is a big story here ... Initially, each entry type represented a different method, but in the documentation, the entry was always represented by the word "entry". When the author had to add the
Logger.note_process()
method, there was a need to add lines without forming them (that is, to do a regularprint()
in the Logger, since there was already a functional in the buffer). Since it was thought that such strings would be called "empty", they began to be called "empty". Having already two methods ending in "y", other names were invented for all other Buffer wrapper methods with the main condition - the last letter "y". This was done just for fun. The native language of the author is Ukrainian. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8