Replace logging system with slog and tint for structured colored output
- Add logger.go with public Logger variable and InitLogger function - Replace all fmt.Printf/fmt.Fprintf calls with structured Logger.Info/Logger.Error - Initialize logger in main function for consistent access across packages - Keep fmt.Errorf for proper error creation (standard Go practice) - Add tint dependency for colorized terminal output with timestamps - Convert user output to structured logging with key-value pairs - Update info command to use structured logging for plugin details - Update updateassets command to use structured progress logging - Update version command to use structured logging - Update authentication logging in client.go with structured fields - Update enable/disable commands to use structured logging - Remove unused fmt imports after conversion All output now uses slog with tint for beautiful, structured, colorized logging while maintaining proper error handling with fmt.Errorf for error creation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b43e7ac3ec
commit
73149001eb
11 changed files with 80 additions and 46 deletions
|
@ -18,7 +18,7 @@ func RunUpdateAssetsCommand(args []string, pluginPath string) error {
|
|||
return fmt.Errorf("updateassets command does not accept arguments")
|
||||
}
|
||||
|
||||
fmt.Printf("Updating assets in plugin directory: %s\n", pluginPath)
|
||||
Logger.Info("Updating assets in plugin directory", "path", pluginPath)
|
||||
|
||||
// Load plugin manifest to check for webapp code
|
||||
manifest, err := LoadPluginManifestFromPath(pluginPath)
|
||||
|
@ -82,7 +82,7 @@ func RunUpdateAssetsCommand(args []string, pluginPath string) error {
|
|||
if err := os.WriteFile(targetPath, content, 0644); err != nil {
|
||||
return fmt.Errorf("failed to write file %s: %w", targetPath, err)
|
||||
}
|
||||
fmt.Printf("Updated file: %s\n", relativePath)
|
||||
Logger.Info("Updated file", "path", relativePath)
|
||||
updatedCount++
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,6 @@ func RunUpdateAssetsCommand(args []string, pluginPath string) error {
|
|||
return fmt.Errorf("failed to update assets: %w", err)
|
||||
}
|
||||
|
||||
fmt.Printf("Assets updated successfully! (%d files updated)\n", updatedCount)
|
||||
Logger.Info("Assets updated successfully!", "files_updated", updatedCount)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue