log: add basic database write debug logging

A series of settings can be found in Settings > Advanced for logging
writes to the database, for each main storage object. "All" logs all
writes, "Deletion" logs Delete* Calls and Write* calls where the
principal data in the object (e.g. address in an EmailAddress object) is
set to "".
This commit is contained in:
Harvey Tindall
2023-10-12 18:12:18 +01:00
parent 7b2a6cdf74
commit 742f5c095a
3 changed files with 222 additions and 0 deletions
+4
View File
@@ -246,8 +246,12 @@ func start(asDaemon, firstCall bool) {
}
if debugMode {
app.debug = logger.NewLogger(os.Stdout, "[DEBUG] ", log.Ltime|log.Lshortfile, color.FgYellow)
// Bind debug log
app.storage.debug = app.debug
app.storage.logActions = generateLogActions(app.config)
} else {
app.debug = logger.NewEmptyLogger()
app.storage.debug = nil
}
if *PPROF {
app.info.Print(warning("\n\nWARNING: Don't use pprof in production.\n\n"))