logs

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ErrorCodeServiceNotFound     = "SERVICE_NOT_FOUND"
	ErrorCodeEnvironmentNotFound = "ENVIRONMENT_NOT_FOUND"
	ErrorCodeK8sConnectionFailed = "K8S_CONNECTION_FAILED"
	ErrorCodeLogsNotAvailable    = "LOGS_NOT_AVAILABLE"
	ErrorCodeInvalidToken        = "INVALID_TOKEN"
	ErrorCodeUnknown             = "UNKNOWN_ERROR"
)

Error codes for common logs service scenarios

Variables

This section is empty.

Functions

func GetErrorCode

func GetErrorCode(err error) string

GetErrorCode extracts the error code from a BusinessError, or returns UNKNOWN for other errors

func GetErrorContext

func GetErrorContext(err error) map[string]interface{}

GetErrorContext extracts the context from a BusinessError

func IsBusinessError

func IsBusinessError(err error) bool

IsBusinessError checks if an error is a BusinessError

func ParseAPIError

func ParseAPIError(err error, context map[string]interface{}) error

ParseAPIError analyzes an API error and converts it to a BusinessError if possible

Types

type BusinessError

type BusinessError struct {
	Code    string                 `json:"code"`
	Message string                 `json:"message"`
	Context map[string]interface{} `json:"context,omitempty"`
}

BusinessError represents a structured business logic error

func (*BusinessError) Error

func (e *BusinessError) Error() string

type GetLogsRequest

type GetLogsRequest struct {
	EnvironmentID string
	ServiceName   string
	Follow        bool
	TailLines     int64
	Page          int
	PageSize      int
}

GetLogsRequest contains parameters for getting logs

type LogLine

type LogLine struct {
	Timestamp time.Time `json:"timestamp"`
	Content   string    `json:"content"`
	Service   string    `json:"service"`
}

LogLine represents a single log line with metadata

type LogsManager

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

LogsManager handles logs business operations

func NewLogsManager

func NewLogsManager(client client.Client) *LogsManager

NewLogsManager creates a new logs manager

func (*LogsManager) FormatLogsAsText

func (s *LogsManager) FormatLogsAsText(logs []LogLine) string

FormatLogsAsText formats logs for text display

func (*LogsManager) GetLogs

func (s *LogsManager) GetLogs(ctx context.Context, req GetLogsRequest) (*LogsResponse, error)

GetLogs retrieves logs for a service in an environment

func (*LogsManager) GetLogsReader

func (s *LogsManager) GetLogsReader(ctx context.Context, req GetLogsRequest) (io.Reader, error)

GetLogsReader returns an io.Reader for logs (useful for MCP resources)

type LogsResponse

type LogsResponse struct {
	Lines    []LogLine `json:"lines"`
	Service  string    `json:"service"`
	EnvID    string    `json:"environment_id"`
	HasNext  bool      `json:"has_next"`
	NextPage int       `json:"next_page"`
	Page     int       `json:"page"`
	PageSize int       `json:"page_size"`
}

LogsResponse contains the result of log retrieval

Jump to

Keyboard shortcuts

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