logging shiny

Published onesixx on

app.py

import logging

formatter_s = logging.Formatter('!!!%(asctime)s|%(levelname)s|%(message)s')
formatter_c = logging.Formatter('%(asctime)s|%(levelname)s|%(message)s')

logger = logging.getLogger("shinylog")

handler_s = logging.StreamHandler()
logger.setLevel(logging.DEBUG)
handler_s.setFormatter(formatter_s)
logger.addHandler(handler_s)

handler_c = logging.FileHandler(ASSET_DIR.joinpath("log_event.log"))
handler_c.setLevel(logging.CRITICAL)
handler_c.setFormatter(formatter_c)
logger.addHandler(handler_c)


# logger
logger.info("Is working well?")
logger.critical("AAAAAAAAAAA")

server.py

import logging
logger = logging.getLogger('shinylog')

logger.info(f"bropress endend {p} loading \n {temp_dr}")
logger.critical("bropress start")
Categories: shiny

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x