• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jeffotoni / quick / 256

17 Mar 2025 03:36AM UTC coverage: 54.197% (+0.2%) from 53.959%
256

push

circleci

jeffotoni
🔹 Added structured logging support with different formats
	•	Implemented text, slog, and json log formats.
	•	slog now correctly follows the user-defined Pattern.
	•	Logs now include custom fields when defined.

🔹 Added ANSI color support for text-based logging
	•	Colors applied only in text and slog formats.
	•	Each field (time, level, method, status, latency) has a
distinct color.
	•	JSON output remains uncolored for compatibility.

🔹 Fixed missing DEBUG logs in slog format
	•	Ensured slog captures and prints DEBUG logs correctly.
	•	Configured slog.Handler to respect LevelDebug.

🔹 Improved log output formatting
	•	JSON logs now print correctly without unnecessary escape
characters.
	•	slog logs now match the expected output structure.
	•	Text logs properly break lines instead of printing in a
single stream.

🔹 Improved test coverage for logger middleware
	•	Added tests for text, slog, and json formats.
	•	Ensured log output is correctly captured in os.Stdout.
	•	Fixed issue where DEBUG logs were not appearing in
tests.

102 of 160 new or added lines in 3 files covered. (63.75%)

2699 of 4980 relevant lines covered (54.2%)

2006.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/example/middleware/logger/net.http/main.go
1
package main
2

3
import (
4
        "net/http"
5

6
        "github.com/jeffotoni/quick/middleware/logger"
7
)
8

NEW
9
func main() {
×
NEW
10
        // Default: Logger in text mode (colored output for terminal)
×
NEW
11
        loggerMiddleware := logger.New()
×
NEW
12

×
NEW
13
        // Logger in JSON mode (structured logs for production)
×
NEW
14
        jsonLoggerMiddleware := logger.New(logger.Config{Format: "json"})
×
NEW
15

×
NEW
16
        // Using middleware in an HTTP server
×
NEW
17
        mux := http.NewServeMux()
×
NEW
18
        mux.Handle("/v1/user", loggerMiddleware(
×
NEW
19
                http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
×
NEW
20
                        w.Write([]byte("Hello, Quick 💕!"))
×
NEW
21
                })))
×
22

NEW
23
        mux.Handle("/v1/logger", jsonLoggerMiddleware(
×
NEW
24
                http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
×
NEW
25
                        w.Write([]byte("Hello, Quick 💕!"))
×
NEW
26
                })))
×
27

NEW
28
        http.ListenAndServe(":8080", mux)
×
29
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc