Documentation
¶
Index ¶
- Constants
- Variables
- type AppMode
- type CacheStorage
- type Config
- func (cfg *Config) EnableOutputDebug()
- func (cfg *Config) EnableOutputTrace()
- func (cfg *Config) EnableOutputVerbose()
- func (cfg *Config) GetLogger() *slog.Logger
- func (cfg *Config) GetLoggerLevel() slog.Level
- func (cfg *Config) GetTerminalOutputFormat() LogFormat
- func (cfg *Config) IsTraceEnabled() bool
- func (cfg *Config) IsVerboseOrHigher() bool
- func (cfg *Config) SetLoggerLevel()
- func (cfg *Config) SetTerminalOutputFormat(terminalLogFormat string) (LogFormat, error)
- func (cfg *Config) SetTrafficLogFormat(logfmt string) error
- type LogFormat
- type LogSourceConfig
Constants ¶
const ( DefaultListenAddr = "127.0.0.1:8080" DefaultCacheDir = "/tmp/llm_proxy" )
Variables ¶
var LogSourceConfigAllTrue = LogSourceConfig{ LogConnectionStats: true, LogRequestHeaders: true, LogRequest: true, LogResponseHeaders: true, LogResponse: true, }
Functions ¶
This section is empty.
Types ¶
type CacheStorage ¶ added in v2.2.0
type CacheStorage struct {
ConfigVersion string `json:"config_version"` // The schema version of this cache index file.
StorageEngine string `json:"storage_engine"` // The storage engine used for this cache
StorageVersion string `json:"storage_version"` // The storage version used for this cache
StoragePath string `json:"storage_path"` // The full path to the storage bucket (file path or database URI)
// contains filtered or unexported fields
}
CacheStorage is a struct that backs a llm_proxy_cache.json file, which configures the cache storage object
func NewCacheStorageConfig ¶
func NewCacheStorageConfig(logger *slog.Logger, cacheDir string) (*CacheStorage, error)
NewCacheStorageConfig creates a new IndexFile object to help with loading/saving meta-state as a json file. This object's purpose is to help loading the other database objects by pointing to their connection settings or file paths.
cacheDir: the directory where the cache index file will be stored
func (*CacheStorage) Load ¶ added in v2.2.0
func (i *CacheStorage) Load() error
Load reads the cache config json file from disk
func (CacheStorage) Save ¶ added in v2.2.0
func (i CacheStorage) Save() error
Save writes the cache config json file to disk
type Config ¶
type Config struct {
AppMode AppMode
Cache *cacheBehavior
// contains filtered or unexported fields
}
Config is the main config mega-struct
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
func (*Config) EnableOutputDebug ¶ added in v2.2.0
func (cfg *Config) EnableOutputDebug()
func (*Config) EnableOutputTrace ¶ added in v2.2.0
func (cfg *Config) EnableOutputTrace()
func (*Config) EnableOutputVerbose ¶ added in v2.2.0
func (cfg *Config) EnableOutputVerbose()
func (*Config) GetLoggerLevel ¶ added in v2.2.0
func (*Config) GetTerminalOutputFormat ¶ added in v2.2.0
func (*Config) IsTraceEnabled ¶ added in v2.2.0
IsOutputDebug returns true if the log is configured to add the source file to the log output
func (*Config) IsVerboseOrHigher ¶
IsVerboseOrHigher returns 1 if the log level is verbose or higher
func (*Config) SetLoggerLevel ¶
func (cfg *Config) SetLoggerLevel()
func (*Config) SetTerminalOutputFormat ¶ added in v2.2.0
func (*Config) SetTrafficLogFormat ¶ added in v2.2.0
type LogFormat ¶ added in v2.2.0
type LogFormat int
func StringToLogFormat ¶ added in v2.2.0
StringToLogFormat converts a string to a LogLevel enum value.
type LogSourceConfig ¶
type LogSourceConfig struct {
LogConnectionStats bool
LogRequestHeaders bool
LogRequest bool
LogResponseHeaders bool
LogResponse bool
}
LogSourceConfig holds the configuration toggles for logging request and response data
func NewLogSourceConfig ¶
func NewLogSourceConfig(cfg *Config) LogSourceConfig
func (*LogSourceConfig) String ¶
func (l *LogSourceConfig) String() string