api

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_LOGS   = 1000 // Maximum number of logs to keep (focused on meaningful events)
	LOG_PREFIX = "logs"
)

Variables

This section is empty.

Functions

func LogClearHandler

func LogClearHandler(w http.ResponseWriter, r *http.Request)

LogClearHandler handles clearing all logs

func LogDeleteHandler

func LogDeleteHandler(w http.ResponseWriter, r *http.Request)

LogDeleteHandler handles log deletion

func LogRetrievalHandler

func LogRetrievalHandler(w http.ResponseWriter, r *http.Request)

LogRetrievalHandler handles log retrieval

func LogStatsHandler

func LogStatsHandler(w http.ResponseWriter, r *http.Request)

LogStatsHandler handles log statistics

func LogSubmissionHandler

func LogSubmissionHandler(w http.ResponseWriter, r *http.Request)

LogSubmissionHandler handles log submission

func LogUpdateHandler

func LogUpdateHandler(w http.ResponseWriter, r *http.Request)

LogUpdateHandler handles log updates

func SetupLoggingRoutes

func SetupLoggingRoutes(mux *http.ServeMux)

SetupLoggingRoutes sets up all logging-related HTTP routes

func SetupLoggingRoutesWithPrefix

func SetupLoggingRoutesWithPrefix(mux *http.ServeMux, prefix string)

SetupLoggingRoutesWithPrefix sets up logging routes with a custom prefix

Types

type LogRetrievalRequest

type LogRetrievalRequest struct {
	Limit     int    `json:"limit,omitempty"`
	Offset    int    `json:"offset,omitempty"`
	Service   string `json:"service,omitempty"`
	Level     string `json:"level,omitempty"`
	StartTime string `json:"start_time,omitempty"`
	EndTime   string `json:"end_time,omitempty"`
	Search    string `json:"search,omitempty"`
}

LogRetrievalRequest represents a request to retrieve logs

type LogRetrievalResponse

type LogRetrievalResponse struct {
	Logs   []logging.LogEntry `json:"logs"`
	Total  int                `json:"total"`
	Limit  int                `json:"limit"`
	Offset int                `json:"offset"`
}

LogRetrievalResponse represents the response for log retrieval

type LogStatsResponse

type LogStatsResponse struct {
	TotalLogs    int                    `json:"total_logs"`
	ServiceStats map[string]int         `json:"service_stats"`
	LevelStats   map[string]int         `json:"level_stats"`
	RecentLogs   []logging.LogEntry     `json:"recent_logs"`
	Metadata     map[string]interface{} `json:"metadata"`
}

LogStatsResponse represents statistics about logs

type LogSubmissionRequest

type LogSubmissionRequest struct {
	Service      string                 `json:"service"`
	Subcomponent string                 `json:"subcomponent,omitempty"`
	Level        string                 `json:"level"`
	Message      string                 `json:"message"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
	Context      map[string]interface{} `json:"context,omitempty"`
}

LogSubmissionRequest represents a request to submit a log entry

type LogUpdateRequest

type LogUpdateRequest struct {
	Message  string                 `json:"message,omitempty"`
	Level    string                 `json:"level,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Context  map[string]interface{} `json:"context,omitempty"`
}

LogUpdateRequest represents a request to update a log entry

type LoggingAPIServer

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

LoggingAPIServer provides a standalone HTTP server for the logging API

func NewLoggingAPIServer

func NewLoggingAPIServer(addr string) *LoggingAPIServer

NewLoggingAPIServer creates a new logging API server

func (*LoggingAPIServer) GetMux

func (s *LoggingAPIServer) GetMux() *http.ServeMux

GetMux returns the HTTP mux for custom route additions

func (*LoggingAPIServer) Start

func (s *LoggingAPIServer) Start() error

Start starts the logging API server

func (*LoggingAPIServer) Stop

func (s *LoggingAPIServer) Stop() error

Stop stops the logging API server

Jump to

Keyboard shortcuts

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