✨ Refactor logging implementation by removing the custom logging utility and transitioning to direct usage of the Zap logger. Update logger configuration in the development environment and clean up related files, including the removal of unused logger configuration JSON. Ensure consistent logging practices across the application.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"caatsm/pkg/utils"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -95,7 +96,7 @@ type TimeReceiver struct {
|
||||
}
|
||||
|
||||
func (h *SITAHeader) Validate() error {
|
||||
log := utils.GetLogger()
|
||||
log := zap.S()
|
||||
// Validate SendTime format (e.g., DDHHMM)
|
||||
if len(h.SendTime) != 6 {
|
||||
err := "invalid send_time format"
|
||||
|
||||
@@ -3,7 +3,6 @@ package parsers
|
||||
import (
|
||||
"caatsm/internal/domain"
|
||||
"caatsm/internal/model"
|
||||
"caatsm/pkg/utils"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
@@ -12,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -292,7 +292,7 @@ type Header struct {
|
||||
}
|
||||
|
||||
func ParseHeader(fullMessage string) (Header, error) {
|
||||
log := utils.GetSugaredLogger()
|
||||
log := zap.S()
|
||||
cleaned := cleanMessage(fullMessage)
|
||||
lines := strings.Split(cleaned, "\n")
|
||||
|
||||
@@ -328,7 +328,7 @@ func parseStartIndicator(line string) (string, string, string, error) {
|
||||
if len(parts) >= 3 && strings.HasPrefix(parts[0], StartIndicatorPrefix) {
|
||||
return parts[0], parts[1], parts[2], nil
|
||||
}
|
||||
utils.GetSugaredLogger().Warnf("invalid start indicator line format: %s", line)
|
||||
zap.S().Warnf("invalid start indicator line format: %s", line)
|
||||
return "", "", "", fmt.Errorf("invalid start indicator line format: %s", line)
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ func parsePriorityAndPrimary(line string) (string, string) {
|
||||
if len(parts) >= 2 {
|
||||
return parts[0], parts[1]
|
||||
}
|
||||
utils.GetSugaredLogger().Warnf("invalid priority and primary address line format: %s", line)
|
||||
zap.S().Warnf("invalid priority and primary address line format: %s", line)
|
||||
return "", ""
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ func getOriginator(line string) (string, string) {
|
||||
if len(match) >= 3 {
|
||||
return match[1], match[2]
|
||||
}
|
||||
utils.GetSugaredLogger().Warnf("invalid originator line format: %s", line)
|
||||
zap.S().Warnf("invalid originator line format: %s", line)
|
||||
return "", ""
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package parsers
|
||||
|
||||
import (
|
||||
"caatsm/internal/domain"
|
||||
"caatsm/pkg/utils"
|
||||
"errors"
|
||||
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func ExtractWaypoint(message string) *domain.WayPoint {
|
||||
@@ -47,7 +47,7 @@ func standardizeSpaces(s string) string {
|
||||
}
|
||||
|
||||
func ParseWithDef(line string, parserDef *LineParser) *domain.ScheduleLine {
|
||||
log := utils.GetSugaredLogger()
|
||||
log := zap.S()
|
||||
cleanLine := standardizeSpaces(strings.TrimSpace(line))
|
||||
words := strings.Split(cleanLine, " ")
|
||||
var flightSchedule = &domain.ScheduleLine{
|
||||
@@ -99,7 +99,7 @@ func ParseWithDef(line string, parserDef *LineParser) *domain.ScheduleLine {
|
||||
|
||||
// ParseLine processes a single line of schedule data and returns a ScheduleLine object.
|
||||
func ParseLine(line string) (*domain.ScheduleLine, error) {
|
||||
log := utils.GetSugaredLogger()
|
||||
log := zap.S()
|
||||
cleanLine := strings.TrimSpace(line)
|
||||
words := strings.Split(cleanLine, " ")
|
||||
flightSchedule := &domain.ScheduleLine{Reference: line}
|
||||
@@ -167,7 +167,7 @@ func updateFlightSchedule(flightSchedule *domain.ScheduleLine, name string, data
|
||||
|
||||
// parseWaypoints processes a slice of waypoint strings and returns a slice of WayPoint objects.
|
||||
func parseWaypoints(target []string) ([]domain.WayPoint, error) {
|
||||
log := utils.GetSugaredLogger()
|
||||
log := zap.S()
|
||||
points := getValidPoints(target)
|
||||
if len(points) == 0 {
|
||||
log.Warn("No waypoints found")
|
||||
|
||||
Reference in New Issue
Block a user