https://github.com/gaurpulkit/logger
Create logs on Discord, Telegram or a local file
https://github.com/gaurpulkit/logger
bot discord file log logger logging python telegram
Last synced: about 2 months ago
JSON representation
Create logs on Discord, Telegram or a local file
- Host: GitHub
- URL: https://github.com/gaurpulkit/logger
- Owner: gaurpulkit
- License: gpl-3.0
- Created: 2020-10-13T10:26:06.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-14T08:19:04.000Z (about 5 years ago)
- Last Synced: 2025-04-07T22:15:12.280Z (about 1 year ago)
- Topics: bot, discord, file, log, logger, logging, python, telegram
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Logger
A Python Module to create logs on Discord, Telegram or a local file
## Installation
Either
```bash
pip install Logger-Zuj3brusu
```
Or
```bash
pip install git+git://github.com/Zuj3brusu/Logger.git
```
## Usage
### Initialization
```python
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
```python
# Set the values of Discord Webhook url and Bot Name
loggerObject.setDiscord(DcUrl = , DcBotName = )
# 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
```python
# Set the values of Telegram Chat ID and Bot API
loggerObject.setTelegram(TgChatID = , TgbotAPI = )
# 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
```python
# Set the values of Telegram Chat ID and Bot API
loggerObject.setFileLogger(
LogFolderLocation = ,
LogFileName = ,
LogFileMode = ,
LogFormat = ,
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.
```python
log="Hello World"
loggerObject.send(log,discord=True,telegram=True,filelogs=True,print=True)
```
## Thanks for checking it out!