Installation
Signale.py can be installed using pip.
[sudo] pip install signalepy
Usage
Package consists of a class Signale, it is the main constructor class. The object created has all the logger functions in it.
Using Loggers
Each logger function takes in three arguments:-
textprefix( Optional )suffix( Optional )
They all are available in the logger object. To create one do this:-
from signalepy import Signale
logger = Signale()
Now you can use the default loggers using this object like:-
...
logger.success("Started Successfully", prefix="Debugger")
logger.warning("`a` function is deprecated", suffix="main.py")
logger.complete("Run Complete")
...
This will produce the following result:-
View All Available Loggers
simplesuccesserrorwarningstartstopwatchimportantpendingcompletedebugpauseinfolikecenterboldunderlinereversedcoloured
Scoped Loggers
To create scoped loggers, define the scope field in the options argument of constructor like:-
from signalepy import Signale
logger = Signale({
"scope": "global scope"
})
logger.success("Scoped Logger Works!")
This will produce the following result:-
You also create multiple scopes by setting the scope field to a list of strings like:-
from signalepy import Signale
logger = Signale({
"scope": ["global scope", "inner scope"]
})
logger.success("Scoped Logger Works!")
This will produce the following result:-
You can also create scoped a logger which is just clone of other by using by using the scoped function like this:-
from signalepy import Signale
logger = Signale({
"scope": "global scope"
})
logger2 = logger.scoped("inner")
logger2.like("I love Signale.py", prefix="Shardul Nalegave", suffix="Creator")
This will produce the following result:-
Note:- All the configuration will be copied to the new logger just the scope will be extended.
Custom Loggers
Custom loggers can be created by passing a array of custom logger configuration to the field custom in the options passed to the constructor. Even clone loggers inherit the parent's custom loggers. 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")
This will produce the following result:-
Underlined Labels
You can set labels to be underlined by setting the underlined field to True in the options passed to the constructor. For example:-
from signalepy import Signale
s = Signale({
"underlined": True
})
s.center("Testing Logger")
s.simple("ABC", prefix="Debugger", suffix="xyz")
s.info("Starting", prefix="Debugger")
s.success("Started Successfully", prefix="Debugger", suffix="xyz")
s.watch("Watching All Files", prefix="Debugger")
s.error("Something Went Wrong", prefix="Debugger")
s.warning("Deprecation Warning", prefix="Debugger")
s.pending("Postponed", prefix="Debugger")
s.debug("Found A Bug on L55", prefix="Debugger")
s.start("Started New Process", prefix="Debugger")
s.pause("Process Paused", prefix="Debugger")
s.complete("Task Completed", prefix="Debugger")
s.important("New Update Available. Please Update!", prefix="Debugger")
s.like("I Love Signale", prefix="Debugger")
s.stop("Stopping", prefix="Debugger")
This will produce the following result:-
Options
Options taken by constructor
-
scope
- Type:
strorlist
Signale Logger Scope
- Type:
-
underlined
- Type:
bool
Labels Should Be Underlined Or Not
- Type:
-
custom
- Type:
list
List of custom logger configuration.
-
Configuration Type:
dictCustom Logger Configuration Dictionary
-
Keys
-
name- Type:
str
Name of the logger
- Type:
-
label- Type:
str
Label displayed beside the icon ( colored text )
- Type:
-
badge- Type:
str
Icon
- Type:
-
color- Type:
str
Color of the icon and label. Should be from:-
reddarkbluepinkgreengreypurpleyellowcyanreset(color reset code)
- Type:
-
-
- Type:
API
-
logger =
Signale(<options>)
Signale- Type:
class
Signale class imported from
signalepymodule
options- Type:
dict
Options Dictionary for logger.
- Returns: Signale Logger Object
Logger object which can be used for logging
- Type:
-
logger.
<logger>(message="", prefix="", suffix="")
logger- Type:
function
Can be any default logger
message- Type:
str
Message to be displayed
prefix- Type:
str - Required: False
Prefix text
suffix- Type:
str - Required: False
Suffix text
- Returns:
None
- Type:
-
logger2 =
logger.scoped(<new scope>)
logger- Type: Signale Logger Object
Parent Logger
new scope- Type:
str
New Scope Name
- Returns: Signale Logger Object
Clone Logger object with extended scope
Licensed Under MIT License A Project By Shardul Nalegave
Metadata
Release files for signalepy 0.3.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| signalepy-0.3.8.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| signalepy-0.3.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.6 kB
Release files / signalepy-0.3.8.tar.gz
| Download URL | signalepy-0.3.8.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30c01d07a94c7c00c92a74e70b4fcd8605013a1935ec326c8bdc655d2cbe4c15
|
|
BLAKE2b-256 checksum How to use checksums |
12d08c3f3ced337ae6ad15ed7e4cf973512d4daa25152638458ddabc1c8d4230
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
|
Release files / signalepy-0.3.8-py3-none-any.whl
| Download URL | signalepy-0.3.8-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0045fad19762220e2f1e1399efcdaf528cea652904f9792ee12a24bb318db009
|
|
BLAKE2b-256 checksum How to use checksums |
c6a6896753d74d15f568441863226246e9a5116f9536a43e0535a01bf9fe16c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6
|