mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-28 08:35:30 +00:00
Improved logs for successful parses
This commit is contained in:
@@ -617,7 +617,7 @@ func (k *KGPZ) Pull() {
|
||||
k.fsmu.Unlock()
|
||||
|
||||
if changed {
|
||||
logging.ObjDebug(&k.Repo, "Remote changed. Reparsing")
|
||||
logging.Info("Repository updated to commit: " + k.Repo.Commit + " (reparsing data)")
|
||||
if err := k.Serialize(); err != nil {
|
||||
logging.Error(err, "Error parsing XML after git pull. Using mixed old/new data.")
|
||||
}
|
||||
@@ -636,6 +636,8 @@ func (k *KGPZ) Pull() {
|
||||
k.Config.Config.GitURL,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
logging.Info("Repository up to date at commit: " + k.Repo.Commit)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/logging"
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/providers/xmlprovider"
|
||||
)
|
||||
|
||||
@@ -54,6 +55,12 @@ func (l *Library) Parse(source xmlprovider.ParseSource, baseDir, commit string)
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
|
||||
if commit != "" {
|
||||
logging.Info("Parsing XML from commit: " + commit)
|
||||
} else {
|
||||
logging.Info("Parsing XML from directory: " + baseDir)
|
||||
}
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
meta := xmlprovider.ParseMeta{
|
||||
Source: source,
|
||||
@@ -142,6 +149,11 @@ func (l *Library) Parse(source xmlprovider.ParseSource, baseDir, commit string)
|
||||
l.cleanup(meta)
|
||||
l.Parses = append(l.Parses, meta)
|
||||
|
||||
// Log parsing statistics
|
||||
logging.Info(fmt.Sprintf("Parse complete: %d agents, %d places, %d works, %d categories, %d issues, %d pieces",
|
||||
len(l.Agents.Array), len(l.Places.Array), len(l.Works.Array),
|
||||
len(l.Categories.Array), len(l.Issues.Array), len(l.Pieces.Array)))
|
||||
|
||||
var errors []string
|
||||
if len(meta.FailedPaths) > 0 {
|
||||
errors = append(errors, fmt.Sprintf("Failed paths: %v", meta.FailedPaths))
|
||||
|
||||
Reference in New Issue
Block a user