logger

package
v0.13.0-go Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logger provides append-only JSONL usage logging to daily files under ~/.dosrouter/logs/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogDir

func LogDir() string

LogDir returns the path to the log directory.

func LogUsage

func LogUsage(entry UsageEntry)

LogUsage appends a JSON line to the daily log file. It silently swallows errors so it never breaks the request flow.

Types

type UsageEntry

type UsageEntry struct {
	Timestamp    string  `json:"timestamp"`
	Model        string  `json:"model"`
	Tier         string  `json:"tier"`
	Cost         float64 `json:"cost"`
	BaselineCost float64 `json:"baselineCost"`
	Savings      float64 `json:"savings"`
	LatencyMs    int64   `json:"latencyMs"`
	Status       string  `json:"status,omitempty"`
	InputTokens  int     `json:"inputTokens,omitempty"`
	OutputTokens int     `json:"outputTokens,omitempty"`
	PartnerID    string  `json:"partnerId,omitempty"`
	Service      string  `json:"service,omitempty"`
}

UsageEntry represents a single usage log record.

Jump to

Keyboard shortcuts

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