Signale.py | Logger For Python CLI Apps

The world of terminals is amazing and it is fun to make it look beautiful. But sometimes it becomes very hard to make it look the way we want.

I you have created Command-Line Apps using Node.js, you might have definitely heard of Signale, Hackable Console Logger. But this doesn’t help when using Python as it is a Node.js Library. So, I decided to make a better clone of Signale for Python named Signale.py.

Signale.py is a Elegant Console Logger For Python Command Line Apps with a total of 15 types of logs and also supports scopes and custom loggers. It is a Open-Source Project licensed under the MIT License. Some examples o how the logs look are in the picture above.


Installation

Signale.py is available on PyPi so to install it just run the following command in you terminal.

    [sudo] pip install signalepy

Note: You need Python and Pip installed and available on PATH Environmental variable.

A Small Tutorial

This is a small tutorial for using Signale.py but to know more see its github repo.

signalepy Package consists of a class Signale, it is the main constructor class. The object created has all the logger functions in it. So after initialising a Signale object, you can use the default loggers like:-

#!/usr/bin/env python
from signalepy import Signale
logger = Signale() # Options can be passed in the constructor
# Logs
logger.success("Started Successfully", prefix="Debugger")
logger.warning("`a` function is deprecated", suffix="main.py")
logger.complete("Run Complete")

This will result to:-

Output

Custom Loggers

Signale.py also supports custom loggers. To do so you have to pass a array of custom logger configuration to the custom field of the options dictionary passed to the constructor. For example:-

from signalepy import Signale

logger = Signale({
"scope": "global scope",
"custom": [
{
"badge": "!",
"label": "Attention",
"color": "red",
"name": "attention"
}
]
})

logger2 = logger.scoped("inner")

logger.attention("It Works!")
logger2.attention("With Logger2")

Will result in:-

Custom Logger Logs

I thank you all for reading and taking interest in my article. If you liked my project please like it on its repo and contribute.