Vistor's Console Logger (VCLog) offers a minimal and colorful console logging. Single-script. No dependencies.
As every logger in the world, there are four levels of logging: info
, debug
, warning
, and error
.
from vclog import Logger
Logger.info("info")
>> |I| info
Logger.debug("debug")
>> |D| debug
Logger.warning("warning")
>> |W| warning
Logger.error("error")
>> |E| error
It also has a plain
method in which color, background color, and style can be specified.
Logger.plain("plain text with format", color="blue", bg_color="green", style="bold")
The logger can also be disabled by setting the disable
attribute to True
. This only works for the instantiated logger.
logger = Logger("instance", disable=True)
logger.info("this message will not be displayed")
The package also offers a format
method to get the formatted string directly.
from vclog import format
message: str = format("Hello, World!", color="red")
The main feature of VCLog is that the Logger
can be used as a static class or it can be instantiated. When instantiated, you can provide a name to be displayed.
Logger.info("as a static method")
>> |I| as a static method
logger = Logger("instance")
logger.info("as an instance")
>> |I| [instance] as an instance
Follow the next steps for installing the simulation on your device.
Requierements:
- Python 3.10.0 or higher
Note: VCLog works on Linux, Windows and Mac.
VCLog is available as a pip package. For installing it just use:
pip install vclog
You can either clone the repository
git clone https://github.com/vistormu/vclog.git
or just copy and paste the logger.py
file.
The official documentation of the package is available on Read the Docs. Here you will find the installation instructions, the API reference and some minimal working examples.