Create logs on Discord, Telegram or a local file
Project description
Logger
A Python Module to create logs on Discord, Telegram or a local file
Installation
Either
pip install Logger-Zuj3brusu
Or
pip install git+git://github.com/Zuj3brusu/Logger.git
Usage
Initialization
from Logger import logger
# Creating a Logger object
loggerObject = logger.Logger()
Initialize Discord Logger (Optional / Only needed to send Discord Logs)
One way to do this is to directly set the values of DcUrl and DcBotName while initializing the logger. Another way to do this is
# Set the values of Discord Webhook url and Bot Name
loggerObject.setDiscord(DcUrl = <Channel Webhook>, DcBotName = <Name of the Bot>)
# Start the Discord Logger
loggerObject.startDiscordLogger()
Initialize Telegram Logger (Optional / Only needed to send Telegram Logs)
One way to do this is to directly set the values of TgChatID and TgbotAPI while initializing the logger. Another way to do this is
# Set the values of Telegram Chat ID and Bot API
loggerObject.setTelegram(TgChatID = <Chat ID>, TgbotAPI = <Bot API>)
# Start the Telegram Logger
loggerObject.startDiscordLogger()
Initialize FileLogger
While the FileLogger is initialized by default, you can still change any/all of the parameters. One way to do this is to directly set the values of FileLogger parameters while initializing the logger. Another way to do this is
# Set the values of Telegram Chat ID and Bot API
loggerObject.setFileLogger(
LogFolderLocation = <LogFolderLocation>,
LogFileName = <LogFileName>,
LogFileMode = <LogFileMode>,
LogFormat = <LogFormat>,
LogLevel = <LogLevel>
)
# Start the FileLogger
loggerObject.startFileLogger()
Sending a log
Logs can be sent using any/all Logger(s). You just need to set the values of parameters to True
for the Loggers for which you want to send the logs.
print
Determines whether to print success or error messages.
log="Hello World"
loggerObject.send(log,discord=True,telegram=True,filelogs=True,print=True)
Thanks for checking it out!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Logger_Zuj3brusu-2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ca6f9e2ce6ab7d0b4046ab6d620d1b4aa4b5388892d14578ade4f8a1f1458a6 |
|
MD5 | 27a48371dfd6171c5b0ee122aefa77b9 |
|
BLAKE2b-256 | 88a17fc3024cf0b6308d6ad13dc8e6a6d11c5cb8884afead1fa533ca2f7ce99b |