LogSuccess logs a success message with emoji prefix
(operation string, details ...interface{})
| 28 | |
| 29 | // LogSuccess logs a success message with emoji prefix |
| 30 | func LogSuccess(operation string, details ...interface{}) { |
| 31 | var msg string |
| 32 | attrs := []slog.Attr{ |
| 33 | slog.String("operation", operation), |
| 34 | slog.Time("timestamp", time.Now()), |
| 35 | } |
| 36 | |
| 37 | if len(details) > 0 { |
| 38 | detailStr := fmt.Sprint(details...) |
| 39 | msg = fmt.Sprintf("✅ %s: %v", operation, detailStr) |
| 40 | attrs = append(attrs, slog.String("details", detailStr)) |
| 41 | } else { |
| 42 | msg = fmt.Sprintf("✅ %s", operation) |
| 43 | } |
| 44 | |
| 45 | GetLogger().LogAttrs(context.Background(), slog.LevelInfo, msg, attrs...) |
| 46 | } |
| 47 | |
| 48 | // LogSuccessf logs a formatted success message with emoji prefix |
| 49 | func LogSuccessf(format string, args ...interface{}) { |
no test coverage detected