utils

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 12 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

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(format string, v ...interface{})

func Error

func Error(format string, v ...interface{})

func ExtractLastUserMessage

func ExtractLastUserMessage(messages interface{}) string

func FormatPrompt

func FormatPrompt(messages interface{}) string

func GenerateID

func GenerateID() string

func GenerateMachineID

func GenerateMachineID() string

func Info

func Info(format string, v ...interface{})

func LogBanner

func LogBanner()

func LogDebug

func LogDebug(debug bool, format string, v ...interface{})

func LogEndpoints

func LogEndpoints(port string)

func LogProviderRequest

func LogProviderRequest(provider, model string)

func LogProviderResponse

func LogProviderResponse(provider string, duration time.Duration, contentLen int)

func LogProviders

func LogProviders(providers map[string]map[string]interface{})

func LogServerStart

func LogServerStart(port string)

func SendJSONError

func SendJSONError(w http.ResponseWriter, message string, code int)

func SendSSEChunk

func SendSSEChunk(w http.ResponseWriter, data interface{}) error

func SetLevel

func SetLevel(l Level)

func SetNoColor

func SetNoColor(nc bool)

func SetOutput

func SetOutput(output io.Writer)

func Warn

func Warn(format string, v ...interface{})

Types

type Level

type Level int
const (
	INFO Level = iota
	WARN
	ERROR
	DEBUG
)

type RequestLogger

type RequestLogger struct {
	ID        string
	Method    string
	Path      string
	Query     string
	IP        string
	StartTime time.Time
	// contains filtered or unexported fields
}

func NewRequestLogger

func NewRequestLogger(method, path, query, ip string) *RequestLogger

func (*RequestLogger) End

func (rl *RequestLogger) End(statusCode int, format string, v ...interface{})

func (*RequestLogger) Error

func (rl *RequestLogger) Error(err error)

func (*RequestLogger) Start

func (rl *RequestLogger) Start()

Jump to

Keyboard shortcuts

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