24 lines
918 B
Plaintext
24 lines
918 B
Plaintext
---
|
|
globs: *.go
|
|
description: Go logging standards and conventions
|
|
---
|
|
|
|
# Go Logging Standards
|
|
|
|
## Always Use cylogger
|
|
- Import: `logger "git.site.quack-lab.dev/dave/cylogger"`
|
|
- Never use `fmt.Printf`, `fmt.Println`, or standard `log` package
|
|
- All output must go through the logger system
|
|
|
|
## Logging Levels
|
|
- `logger.Debug()` - Detailed debugging info, internal state
|
|
- `logger.Info()` - Important business events, user-facing messages
|
|
- `logger.Warning()` - Warning conditions (not `logger.Warn()`)
|
|
- `logger.Error()` - Error conditions, failures
|
|
|
|
## Best Practices
|
|
- Include context in log messages (character names, operation details)
|
|
- Use structured logging with format strings: `logger.Info("Operation completed for %s", name)`
|
|
- Avoid redundant log lines right next to each other
|
|
- Log at appropriate levels - don't spam with unnecessary debug logs
|
|
- Always log errors with context about what operation failed |