systemerror

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSystemErrorModule

func NewSystemErrorModule(logger logging.Logger, deps *core.Dependencies) core.Module

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 CreateErrorInput struct {
	ErrorLevel    string
	ErrorType     string
	ErrorMsg      string
	ErrorStack    string
	ErrorCode     string
	RequestID     string
	RequestMethod string
	RequestPath   string
	RequestBody   string
	UserID        *uuid.UUID
}

type ErrorQueryInput

type ErrorQueryInput struct {
	Page      int
	PageSize  int
	StartDate *time.Time
	EndDate   *time.Time
	Level     string
	Type      string
	RequestID string
}

type SystemErrorHandler

type SystemErrorHandler struct {
	// contains filtered or unexported fields
}

func NewSystemErrorHandler

func NewSystemErrorHandler(service *SystemErrorService, logger logging.Logger) *SystemErrorHandler

func (*SystemErrorHandler) Clear

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

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

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

func (m *SystemErrorModule) Middleware(logger logging.Logger) func(http.Handler) http.Handler

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

func (s *SystemErrorService) ClearOldErrors(ctx context.Context, retentionDays int) (int, error)

ClearOldErrors deletes errors older than retention days

func (*SystemErrorService) Create

func (s *SystemErrorService) Create(input *CreateErrorInput)

Create Asynchronously records a system error

func (*SystemErrorService) Delete

func (s *SystemErrorService) Delete(ctx context.Context, id uuid.UUID) error

Delete deletes a single error entry

func (*SystemErrorService) List

List queries system errors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL