- Restructured info.go with extracted helper functions for better readability - Enhanced updateassets.go with cleaner asset processing logic and better error handling - Improved client.go formatting and logging consistency - Added logs.go for centralized logging functionality - Updated dependencies in go.mod to include tint as direct dependency - Cleaned up README.md with simplified installation instructions and structure - Added comprehensive assets/ directory with build configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
37 lines
719 B
Go
37 lines
719 B
Go
package pluginctl
|
|
|
|
import (
|
|
"log/slog"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/lmittmann/tint"
|
|
)
|
|
|
|
// Logger is the global logger instance.
|
|
var Logger *slog.Logger
|
|
|
|
// InitLogger initializes the global logger.
|
|
func InitLogger() {
|
|
// Create a tint handler for colorized output
|
|
handler := tint.NewHandler(os.Stderr, &tint.Options{
|
|
Level: slog.LevelInfo,
|
|
TimeFormat: time.Kitchen,
|
|
AddSource: false,
|
|
NoColor: false,
|
|
})
|
|
|
|
Logger = slog.New(handler)
|
|
}
|
|
|
|
// SetLogLevel sets the minimum logging level.
|
|
func SetLogLevel(level slog.Level) {
|
|
handler := tint.NewHandler(os.Stderr, &tint.Options{
|
|
Level: level,
|
|
TimeFormat: time.Kitchen,
|
|
AddSource: false,
|
|
NoColor: false,
|
|
})
|
|
|
|
Logger = slog.New(handler)
|
|
}
|