func ModifyToSentryLogger(ctx context.Context, logger *zap.Logger, client *sentry.Client, configDb *configdb.ConfigDb) *zap.Logger { cfg := zapsentry.Configuration{ Level: zapcore.ErrorLevel, //when to send message to sentry EnableBreadcrumbs: true, // enable sending b
(logger *zap.Logger, err error, msg string, fields ...zap.Field)
| 306 | |
| 307 | // LogError logs the error with the provided fields if the error is not context.Canceled. |
| 308 | func LogError(logger *zap.Logger, err error, msg string, fields ...zap.Field) { |
| 309 | if logger == nil { |
| 310 | fmt.Println("Failed to log error. Logger is nil.") |
| 311 | return |
| 312 | } |
| 313 | if !errors.Is(err, context.Canceled) { |
| 314 | logger.Error(msg, append(fields, zap.Error(err))...) |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | // RemoveDoubleQuotes removes all double quotes from the values in the provided template map. |
| 319 | // This function handles cases where the templating engine fails to parse values containing both single and double quotes. |