Built-in Logger

Xyra includes a simple, optional logger to provide insights into your application's behavior, which is especially useful during development.

Enabling the Logger

To enable the logger, set the logger parameter to True in the app.listen() method.

Python
from xyra import App, Request, Response

app = App()

@app.get("/")
def home(req: Request, res: Response):
    res.text("Hello, World!")

if __name__ == "__main__":
    # Enable the logger when starting the server
    app.listen(8000, logger=True)

Logger Output

When enabled, Xyra will print information about incoming requests and server status directly to your console.

Output
🚀 Xyra server running on http://0.0.0.0:8000
[INFO] 127.0.0.1:54321 - GET / 200 OK
[INFO] 127.0.0.1:54322 - POST /api/users 201 Created

The log format includes the client's IP address and port, the HTTP method, the requested path, and the response status code. This feature is a great tool for debugging and monitoring your application.