🚀 Send your Python logs and print statements directly to Telegram using a bot.
No complex setup — just import, set your bot token & chat ID, and start logging.
pip install loggerXio
from loggerXio import setup_logger
# Replace with your bot token and chat ID
logger = setup_logger(bot_token="YOUR_BOT_TOKEN", chat_id=123456789)
✅ That's it! 🎉 Now all logs and print()
messages will be sent to your Telegram chat.
All parameters default to True
(except level
, which defaults to logging.INFO
).
You can turn any of them off by setting them to False
in setup_logger()
.
Your Telegram bot token (get it from 🤖 BotFather).
Example:
setup_logger("bot_token=YOUR_BOT_TOKEN", chat_id=123456789)
Your Telegram chat ID (can be a group or private chat).
Example:
setup_logger(bot_token="YOUR_BOT_TOKEN", chat_id=987654321)
Whether to include a timestamp in your logs. Default: True
.
Example (disable time):
setup_logger(bot_token="YOUR_BOT_TOKEN", chat_id=123456789, time=False)
Also print logs to your console. Default: True
.
Example (disable console output):
setup_logger(bot_token="YOUR_BOT_TOKEN", chat_id=123456789, show_logs=False)
Capture print()
messages and send them to Telegram. Default: True
.
Example (disable capturing print):
setup_logger(bot_token="YOUR_BOT_TOKEN", chat_id=123456789, fetch_print=False)
If True
, uses standard logging levels (INFO
, WARNING
, ERROR
).
If False
, only captures print messages. Default: True
.
Example (capture only print statements):
setup_logger(bot_token="YOUR_BOT_TOKEN", chat_id=123456789, level_info=False)
from loggerXio import setup_logger
import logging
import time
# Setup with all default parameters
logger = setup_logger(
bot_token="YOUR_BOT_TOKEN",
chat_id=123456789,
time=True,
show_logs=True,
fetch_print=True,
level_info=True
)
# Test logging
logger.info("Hello from loggerXio!")
print("This is a print message.")
time.sleep(5) #Just for test script
- If you disable
level_info=True
, normal logging levels won't be used — onlyprint()
messages will be captured. - Works in private chats, groups, channels.
- Uses threads to avoid blocking your main program.
- always when script start, first log will take few seconds for send log.
© 2025 All Rights Reserved.
Developed and Created by
─ㅤ𝐀ㅤʀㅤɪㅤꜱㅤᴇㅤメ.