Skip to content

Commit d5c9351

Browse files
committed
Format.
1 parent f3d0ada commit d5c9351

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

examples/http/logging_middleware.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
package main
66

77
import (
8+
"log"
89
"net/http"
910
"time"
10-
"log"
1111
)
1212

1313
// responseWriter wraps http.ResponseWriter to capture the status code
@@ -24,20 +24,20 @@ func (rw *responseWriter) WriteHeader(code int) {
2424
func loggingHandler(handler http.Handler) http.Handler {
2525
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2626
start := time.Now()
27-
27+
2828
// Create a response writer wrapper to capture status code
2929
wrapped := &responseWriter{ResponseWriter: w, statusCode: http.StatusOK}
30-
30+
3131
// Log request details
32-
log.Printf("[REQUEST] %s | %s | %s %s",
32+
log.Printf("[REQUEST] %s | %s | %s %s",
3333
start.Format(time.RFC3339),
3434
r.RemoteAddr,
3535
r.Method,
3636
r.URL.Path)
37-
37+
3838
// Call the actual handler
3939
handler.ServeHTTP(wrapped, r)
40-
40+
4141
// Log response details
4242
duration := time.Since(start)
4343
log.Printf("[RESPONSE] %s | %s | %s %s | Status: %d | Duration: %v",

examples/http/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func main() {
4444

4545
os.Args = append(os.Args[:1], os.Args[2:]...)
4646
flag.Parse()
47-
47+
4848
switch mode {
4949
case "server":
5050
runServer(*host, *port)
@@ -97,8 +97,8 @@ func getTime(ctx context.Context, ss *mcp.ServerSession, params *mcp.CallToolPar
9797
"boston": "Boston",
9898
}
9999

100-
response := fmt.Sprintf("The current time in %s is %s",
101-
cityNames[city],
100+
response := fmt.Sprintf("The current time in %s is %s",
101+
cityNames[city],
102102
now.Format(time.RFC3339))
103103

104104
return &mcp.CallToolResultFor[any]{
@@ -140,7 +140,7 @@ func runServer(host, port string) {
140140

141141
func runClient(host, port string) {
142142
ctx := context.Background()
143-
143+
144144
// Create the URL for the server
145145
url := fmt.Sprintf("http://%s:%s", host, port)
146146
log.Printf("Connecting to MCP server at %s", url)
@@ -176,7 +176,7 @@ func runClient(host, port string) {
176176

177177
// Call the cityTime tool for each city
178178
cities := []string{"nyc", "sf", "boston"}
179-
179+
180180
log.Println("Getting time for each city...")
181181
for _, city := range cities {
182182
// Call the tool

0 commit comments

Comments
 (0)