Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions integration_tests/index.py
Original file line number Diff line number Diff line change
@@ -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!"


Expand Down
6 changes: 6 additions & 0 deletions robyn/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Binary file added robyn/robyn.cp311-win_amd64.pyd
Binary file not shown.