Share your repls and programming experiences

← Back to all posts
dblogger - Python logging to the Replit Database
h
jachands (3)

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))

Logging Methods

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

Hope it helps! Happy logging :)

Comments
hotnewtop