diff --git a/integration_tests/index.py b/integration_tests/index.py index 055892833..bba0855c1 100644 --- a/integration_tests/index.py +++ b/integration_tests/index.py @@ -1,10 +1,15 @@ from robyn import Robyn +from robyn import logger app = Robyn(__file__) +logger.logging_file("logs.logs") + @app.get("/") async def h(): + logger.info("Hello logging file") + return "Hello, world!" diff --git a/robyn/logger.py b/robyn/logger.py index 18dacdd43..186afc7f3 100644 --- a/robyn/logger.py +++ b/robyn/logger.py @@ -20,6 +20,12 @@ class Logger: def __init__(self): self.logger = logging.getLogger(__name__) + def logging_file(self, filename: str): + FileOutputHandler = logging.FileHandler(filename) + formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s") + FileOutputHandler.setFormatter(formatter) + self.logger.addHandler(FileOutputHandler) + def _format_msg( self, msg: str, diff --git a/robyn/robyn.cp311-win_amd64.pyd b/robyn/robyn.cp311-win_amd64.pyd new file mode 100644 index 000000000..ebdfcdfaf Binary files /dev/null and b/robyn/robyn.cp311-win_amd64.pyd differ