utils

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 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 added in v0.28.0

func CloseLogger() error

CloseLogger closes the log file and resets the logger.

func Debug added in v0.28.0

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

Debug logs a debug message.

func Error added in v0.28.0

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 GetTokmanSourceDir added in v0.28.0

func GetTokmanSourceDir() string

func Info added in v0.28.0

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