Documentation
¶
Index ¶
- func NewSystemErrorModule(logger logging.Logger, deps *core.Dependencies) core.Module
- func RecoveryMiddleware(service *SystemErrorService, logger logging.Logger) func(next http.Handler) http.Handler
- type ClearInput
- type CreateErrorInput
- type ErrorQueryInput
- type SystemErrorHandler
- type SystemErrorModule
- type SystemErrorService
- func (s *SystemErrorService) ClearOldErrors(ctx context.Context, retentionDays int) (int, error)
- func (s *SystemErrorService) Create(input *CreateErrorInput)
- func (s *SystemErrorService) Delete(ctx context.Context, id uuid.UUID) error
- func (s *SystemErrorService) List(ctx context.Context, input *ErrorQueryInput) ([]*ent.SystemError, int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSystemErrorModule ¶
NewSystemErrorModule creates a new system error module
func RecoveryMiddleware ¶
func RecoveryMiddleware(service *SystemErrorService, logger logging.Logger) func(next http.Handler) http.Handler
RecoveryMiddleware captures panics and records them
Types ¶
type ClearInput ¶
type ClearInput struct {
RetentionDays int `json:"retentionDays"`
}
ClearInput defines parameters for clearing logs
type CreateErrorInput ¶
type ErrorQueryInput ¶
type SystemErrorHandler ¶
type SystemErrorHandler struct {
// contains filtered or unexported fields
}
func NewSystemErrorHandler ¶
func NewSystemErrorHandler(service *SystemErrorService, logger logging.Logger) *SystemErrorHandler
func (*SystemErrorHandler) Clear ¶
func (h *SystemErrorHandler) Clear(w http.ResponseWriter, r *http.Request)
Clear deletes old errors @Summary Clear old system errors @Tags Logs @Accept json @Produce json @Param request body ClearInput true "Retention settings" @Success 200 {object} responder.Response @Router /logs/errors/clear [post]
func (*SystemErrorHandler) Delete ¶
func (h *SystemErrorHandler) Delete(w http.ResponseWriter, r *http.Request)
Delete deletes a single error entry @Summary Delete system error log @Tags Logs @Param id path string true "Log ID" @Success 200 {object} responder.Response @Router /logs/errors/{id} [delete]
func (*SystemErrorHandler) List ¶
func (h *SystemErrorHandler) List(w http.ResponseWriter, r *http.Request)
List returns a list of system errors @Summary List system errors @Tags Logs @Accept json @Produce json @Param page query int false "Page number" @Param pageSize query int false "Page size" @Param level query string false "Error Level" @Param type query string false "Error Type" @Param request_id query string false "Request ID" @Success 200 {object} responder.Response @Router /logs/errors [get]
type SystemErrorModule ¶
type SystemErrorModule struct {
// contains filtered or unexported fields
}
SystemErrorModule manages the system error module
func (*SystemErrorModule) Middleware ¶
Middleware returns the recovery middleware
func (*SystemErrorModule) Name ¶
func (m *SystemErrorModule) Name() string
func (*SystemErrorModule) RegisterPrivateRoutes ¶
func (m *SystemErrorModule) RegisterPrivateRoutes(r chi.Router)
RegisterPrivateRoutes registers protected system error endpoints
func (*SystemErrorModule) RegisterPublicRoutes ¶
func (m *SystemErrorModule) RegisterPublicRoutes(r chi.Router)
RegisterPublicRoutes registers public system error endpoints (none)
type SystemErrorService ¶
type SystemErrorService struct {
// contains filtered or unexported fields
}
func NewSystemErrorService ¶
func NewSystemErrorService(client *ent.Client, logger logging.Logger) *SystemErrorService
func (*SystemErrorService) ClearOldErrors ¶
ClearOldErrors deletes errors older than retention days
func (*SystemErrorService) Create ¶
func (s *SystemErrorService) Create(input *CreateErrorInput)
Create Asynchronously records a system error
func (*SystemErrorService) List ¶
func (s *SystemErrorService) List(ctx context.Context, input *ErrorQueryInput) ([]*ent.SystemError, int, error)
List queries system errors