Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
3

dblogger - Python logging to the Replit Database

jachands
jachands

Logging is important, especially for Always On repls where you can't always monitor the console output. That's why I started using the Replit Database to save my logs.

After copying the dblogger.py to your project, logging is easy! Here's an example:

from dblogger import DBLogger logger = DBLogger('x:log', 500) # Log something! logger.info("Hello logs!")

Want to view your logs? Open python in Shell and run:

from replit import db for x in db['x:log']: print(list(x))

image

Logging Methods

logger.info(msg) logger.exception(e) logger.warn(msg)

Hope it helps! Happy logging :)

2 years ago

Voters

Comments

TopNew
1
Load more