Added setting for LogLevel

This commit is contained in:
Pijus Kamandulis
2025-01-09 21:07:41 +02:00
parent c2c9dc03b3
commit 8b8b087aab
14 changed files with 200 additions and 84 deletions

View File

@@ -135,7 +135,7 @@ func (h *Handlers) PatchDocument(c *gin.Context) {
currentDocumentBytes, err := json.Marshal(document)
if err != nil {
logger.Error("Failed to marshal existing document:", err)
logger.ErrorLn("Failed to marshal existing document:", err)
c.JSON(http.StatusInternalServerError, gin.H{"message": "Failed to marshal existing document"})
return
}
@@ -149,7 +149,7 @@ func (h *Handlers) PatchDocument(c *gin.Context) {
var modifiedDocument map[string]interface{}
err = json.Unmarshal(modifiedDocumentBytes, &modifiedDocument)
if err != nil {
logger.Error("Failed to unmarshal modified document:", err)
logger.ErrorLn("Failed to unmarshal modified document:", err)
c.JSON(http.StatusInternalServerError, gin.H{"message": "Failed to unmarshal modified document"})
return
}

View File

@@ -16,7 +16,7 @@ func RequestLogger() gin.HandlerFunc {
bodyStr := readBody(rdr1)
if bodyStr != "" {
logger.Debug(bodyStr)
logger.DebugLn(bodyStr)
}
c.Request.Body = rdr2