Skip to content

Logger ​

Added: v1.0.0

Request logging middleware that writes colored, human-readable request logs to stdout. Logs method, path, status code, duration, client IP, request size, and response size.

Usage ​

go
r.Use(middleware.Logger)

Example Output ​

[ZEN] 2026/07/10 - 10:04:04 |   200 |    2.50ms | 127.0.0.1       |     512->256B | GET    /users
[ZEN] 2026/07/10 - 10:05:12 |   201 |   10.80ms | 10.0.0.1        |     256->64B  | POST   /api/users

Status codes are color-coded: green (2xx), cyan (3xx), yellow (4xx), red (5xx). Methods are color-coded: blue (GET), cyan (POST), yellow (PUT), red (DELETE).

Released under the MIT License.