log

package
v0.0.0-...-1746241 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 14 Imported by: 2 modules, 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.

README

Log Service

Responsibility

Canonical home for application and project log flows: system log read-side, project log ingest, batching, retention cleanup and aggregate querying.

Structure

  • service.go — orchestration and public service methods.
  • config.go — logging runtime configuration.
  • runtime.go / worker.go / store.go / jobs.go — mutable runtime, batching and cleanup internals.
  • models/ — _logs, logging_projects and app logs persistence models.
  • apis/ — module-owned HTTP bindings for admin logs and project log ingest.
  • queries/ — read-side query helpers.
  • forms/ — request/submit DTOs.
  • migrations/ — module-owned app/project logging schema.

Dependencies

  • core.App
  • services/base/models for developer tokens
  • tools/search for system log querying

Public flows

  • Query PocketBase internal request logs.
  • Create logging projects.
  • Ingest single or batched app logs with project API keys.
  • Flush buffered logs to storage.
  • Cleanup project logs by retention window.

Migration notes

  • PocketBase internal _logs remains core-owned by migrations/logs.
  • Product/app logging tables are registered from services/log/migrations through migrations/dbase/log_module.go.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Descriptor = servicebase.Descriptor{
	Name:    "log",
	Purpose: "Provides system log read-side APIs plus project app-log ingest, batching, retention cleanup and stats.",
	Dependencies: []string{
		"core.App",
		"services/base/models",
		"tools/search",
	},
	Operations: []string{
		"List",
		"Stats",
		"FindByID",
		"IngestLogs",
		"Shutdown",
		"GetStats",
	},
}

Functions

func CleanupLogs

func CleanupLogs(app core.App) error

Types

type Config

type Config struct {
	BatchSize      int
	FlushInterval  time.Duration
	BufferSize     int
	WorkerPoolSize int
	RetryAttempts  int
	RetryBackoff   time.Duration
}

func DefaultConfig

func DefaultConfig() *Config

type IngestResult

type IngestResult struct {
	Success   bool     `json:"success"`
	Processed int      `json:"processed"`
	Failed    int      `json:"failed"`
	Errors    []string `json:"errors,omitempty"`
}

type LogEntry

type LogEntry struct {
	Level     string                 `json:"level"`
	Timestamp string                 `json:"timestamp"`
	Source    string                 `json:"source"`
	Message   string                 `json:"message"`
	Context   map[string]interface{} `json:"context"`
	TraceID   string                 `json:"trace_id"`
	ProjectId string                 `json:"-"`
}

type LoggingStats

type LoggingStats struct {
	LogsBuffered    int64 `json:"logs_buffered"`
	LogsFlushed     int64 `json:"logs_flushed"`
	Errors          int64 `json:"errors"`
	BufferOverflows int64 `json:"buffer_overflows"`
}

type Service

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

func New

func New(app core.App) *Service

func (*Service) FindByID

func (s *Service) FindByID(id string) (*logmodels.Log, error)

func (*Service) GetStats

func (s *Service) GetStats() LoggingStats

func (*Service) IngestLogs

func (s *Service) IngestLogs(ctx context.Context, projectId string, entries []LogEntry) (*IngestResult, error)

func (*Service) List

func (s *Service) List(query string, fieldResolver *search.SimpleFieldResolver) (*search.Result, error)

func (*Service) Shutdown

func (s *Service) Shutdown(ctx context.Context) error

func (*Service) Stats

func (s *Service) Stats(expr dbx.Expression) ([]*daos.LogsStatsItem, error)

Directories

Path Synopsis
Package forms contains log service request and submit forms.
Package forms contains log service request and submit forms.
Package queries contains read-side query helpers for the log service.
Package queries contains read-side query helpers for the log service.

Jump to

Keyboard shortcuts

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