File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,24 @@ import (
1616
1717var rxURL = regexp .MustCompile (`^/regexp\d*` )
1818
19+ // main initializes the Gin router, sets up various routes with different logging
20+ // configurations, and starts the server on port 8080. The routes demonstrate
21+ // different ways to use the logger middleware, including logging all requests,
22+ // skipping certain paths, adding custom fields, and using JSON format logs.
23+ //
24+ // Routes:
25+ // - GET /pong: Logs request with default logger settings.
26+ // - GET /ping: Logs request with custom settings, including skipping paths and using UTC time.
27+ // - GET /skip: Logs request but skips logging for the /skip path.
28+ // - GET /regexp1: Logs request but skips logging for paths matching the provided regex.
29+ // - GET /regexp2: Logs request but skips logging for paths matching the provided regex.
30+ // - GET /id: Logs request with custom fields including trace ID, span ID, and a custom request ID.
31+ // - GET /json: Logs request in JSON format.
32+ // - GET /health: Skips logging for the /health path.
33+ // - GET /v1/ping: Skips logging for GET requests in the /v1 group.
34+ // - POST /v1/ping: Logs request for POST requests in the /v1 group.
35+ //
36+ // The server listens on 0.0.0.0:8080.
1937func main () {
2038 r := gin .New ()
2139
You can’t perform that action at this time.
0 commit comments