fix: added futher logging

This commit is contained in:
pommee
2025-09-05 20:03:15 +02:00
parent fa37c8d5c9
commit eddf0ad24a
3 changed files with 7 additions and 2 deletions

View File

@@ -132,6 +132,7 @@ func (api *API) updatePassword(c *gin.Context) {
return
}
logMsg := fmt.Sprintf("Password changed for user '%s'", existingUser.Username)
api.DNSServer.Audits.CreateAudit(&audit.Entry{
Topic: audit.TopicUser,
Message: logMsg,
@@ -141,7 +142,7 @@ func (api *API) updatePassword(c *gin.Context) {
Content: logMsg,
Severity: SeverityWarning,
})
log.Info("Password has been changed!")
log.Warning(logMsg)
c.Status(http.StatusOK)
}

View File

@@ -127,6 +127,8 @@ func (m *ApiKeyManager) CreateKey(name string) (string, error) {
m.keyCache[name] = ApiKey{Name: name, Key: apiKey, CreatedAt: createdAt}
m.cacheMu.Unlock()
log.Info("Created new API key with name: %s", name)
return apiKey, nil
}

View File

@@ -302,7 +302,9 @@ func (api *API) importDatabase(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Critical error: restored database is not functional"})
return
}
c.JSON(http.StatusInternalServerError, gin.H{"error": "Imported database is not functional, restored from backup"})
log.Info("Database restored successfully from backup %s", backupPath)
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("Failed to use imported database, restored from backup %s", backupPath)})
return
}