logger: slog logger #266
| @@ -103,12 +103,6 @@ func (s *slogLogger) Log(ctx context.Context, lvl Level, args ...any) { | |||||||
| 		log.Fatalln(msg, attr) | 		log.Fatalln(msg, attr) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if slvl == slog.LevelError { |  | ||||||
| 		l := s.slog.With(slog.Any("ProcStatus", "ERROR"), slog.Any("ErrorText", msg)) |  | ||||||
| 		l.LogAttrs(ctx, slvl, "", attr...) |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	s.slog.LogAttrs(ctx, slvl, msg, attr...) | 	s.slog.LogAttrs(ctx, slvl, msg, attr...) | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -125,12 +119,6 @@ func (s *slogLogger) Logf(ctx context.Context, lvl Level, format string, args .. | |||||||
| 		log.Fatalln(msg, attr) | 		log.Fatalln(msg, attr) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if slvl == slog.LevelError { |  | ||||||
| 		l := s.slog.With(slog.Any("ProcStatus", "ERROR"), slog.Any("ErrorText", msg)) |  | ||||||
| 		l.LogAttrs(ctx, slvl, "", attr...) |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	s.slog.LogAttrs(ctx, slvl, msg, attr...) | 	s.slog.LogAttrs(ctx, slvl, msg, attr...) | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -229,9 +217,6 @@ func renameTime(groups []string, a slog.Attr) slog.Attr { | |||||||
| 	if a.Key == slog.TimeKey { | 	if a.Key == slog.TimeKey { | ||||||
| 		a.Key = "@timestamp" | 		a.Key = "@timestamp" | ||||||
| 	} | 	} | ||||||
| 	if a.Key == slog.MessageKey { |  | ||||||
| 		a.Key = "message" |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return a | 	return a | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user