feat(logging): add detailed logging throughout application components
- Implement logging in router setup, auth handlers, and frpc operations - Add SoftwareInfo struct for version tracking and logging - Enhance error messages with more context and logging - Replace direct error returns with formatted error logging - Add debug logs for token operations and request validations
This commit is contained in:
@@ -11,7 +11,25 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type SoftwareInfo struct {
|
||||
Name string
|
||||
Version string
|
||||
Developer string
|
||||
BuildVer int16
|
||||
Description string
|
||||
BuildType string
|
||||
}
|
||||
|
||||
func main() {
|
||||
softwareInfo := SoftwareInfo{
|
||||
Name: "Super-frpc",
|
||||
Version: "0.0.1",
|
||||
Developer: "Madobi Nanami",
|
||||
BuildVer: 1,
|
||||
Description: "A backend application for managing local frpc instances, allowing users to easily start, stop, restart, and perform daily maintenance operations on frpc instances. It also provides automated error handling, such as automatic restart when an instance crashes.",
|
||||
BuildType: "debug",
|
||||
}
|
||||
postLog.Info(fmt.Sprintf("%s %s (Build %d.%s) by %s", softwareInfo.Name, softwareInfo.Version, softwareInfo.BuildVer, softwareInfo.BuildType, softwareInfo.Developer))
|
||||
configPath := flag.String("config", "./config.json", "path to config file")
|
||||
dbPath := flag.String("db", "./database.db", "path to database file")
|
||||
flag.Parse()
|
||||
@@ -23,7 +41,7 @@ func main() {
|
||||
"configDir": "./configs"
|
||||
}`
|
||||
if err := os.WriteFile(*configPath, []byte(defaultConfig), 0644); err != nil {
|
||||
postLog.Fatal(fmt.Sprintf("Failed to create default config file: %v", err))
|
||||
postLog.Warning(fmt.Sprintf("Failed to create default config file: %v", err))
|
||||
}
|
||||
postLog.Info(fmt.Sprintf("Created default config file at %s", *configPath))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user