utils

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *slog.Logger

Logger is the global logger instance.

Functions

func Abs

func Abs(x int) int

func Clamp

func Clamp(x, min, max int) int

func CloseLogger

func CloseLogger() error

CloseLogger closes the log file and resets the logger.

func Debug

func Debug(msg string, args ...any)

Debug logs a debug message.

func Error

func Error(msg string, args ...any)

Error logs an error message.

func FormatBytes

func FormatBytes(bytes int64) string

func FormatDuration

func FormatDuration(ms int64) string

func FormatTokens

func FormatTokens(n int) string

func FormatTokens64

func FormatTokens64(n uint64) string

func GetModelFamily

func GetModelFamily(modelName string) string

func GetTokSourceDir

func GetTokSourceDir() string

func Info

func Info(msg string, args ...any)

Info logs an info message.

func InitLogger

func InitLogger(logPath string, level LogLevel) error

InitLogger initializes the global logger.

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func ShortenPath

func ShortenPath(path string, maxLen int) string

func Warn

func Warn(msg string, args ...any)

Warn logs a warning message.

Types

type LogLevel

type LogLevel string

LogLevel represents logging severity.

const (
	LevelDebug LogLevel = "debug"
	LevelInfo  LogLevel = "info"
	LevelWarn  LogLevel = "warn"
	LevelError LogLevel = "error"
)

Jump to

Keyboard shortcuts

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