Add custom logger with source location tracking and remove verbose database logs
- Create internal/logger package with Logger wrapper around slog - Logger automatically adds source file, line number, and function name to all log entries - Use golang.org/x/term to properly detect if stdout is a terminal - Replace all slog.Logger usage with logger.Logger throughout the codebase - Remove verbose logging from database GetStats() method - Update all constructors and dependencies to use the new logger
This commit is contained in:
@@ -2,12 +2,12 @@ package routewatch
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"git.eeqj.de/sneak/routewatch/internal/logger"
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ func CLIEntry() {
|
||||
app := fx.New(
|
||||
getModule(),
|
||||
fx.StopTimeout(shutdownTimeout), // Allow 60 seconds for graceful shutdown
|
||||
fx.Invoke(func(lc fx.Lifecycle, rw *RouteWatch, logger *slog.Logger) {
|
||||
fx.Invoke(func(lc fx.Lifecycle, rw *RouteWatch, logger *logger.Logger) {
|
||||
lc.Append(fx.Hook{
|
||||
OnStart: func(_ context.Context) error {
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user