mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
Improved logs for successful parses
This commit is contained in:
@@ -617,7 +617,7 @@ func (k *KGPZ) Pull() {
|
|||||||
k.fsmu.Unlock()
|
k.fsmu.Unlock()
|
||||||
|
|
||||||
if changed {
|
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 {
|
if err := k.Serialize(); err != nil {
|
||||||
logging.Error(err, "Error parsing XML after git pull. Using mixed old/new data.")
|
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,
|
k.Config.Config.GitURL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logging.Info("Repository up to date at commit: " + k.Repo.Commit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Theodor-Springmann-Stiftung/kgpz_web/helpers/logging"
|
||||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/providers/xmlprovider"
|
"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()
|
l.mu.Lock()
|
||||||
defer l.mu.Unlock()
|
defer l.mu.Unlock()
|
||||||
|
|
||||||
|
if commit != "" {
|
||||||
|
logging.Info("Parsing XML from commit: " + commit)
|
||||||
|
} else {
|
||||||
|
logging.Info("Parsing XML from directory: " + baseDir)
|
||||||
|
}
|
||||||
|
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
meta := xmlprovider.ParseMeta{
|
meta := xmlprovider.ParseMeta{
|
||||||
Source: source,
|
Source: source,
|
||||||
@@ -142,6 +149,11 @@ func (l *Library) Parse(source xmlprovider.ParseSource, baseDir, commit string)
|
|||||||
l.cleanup(meta)
|
l.cleanup(meta)
|
||||||
l.Parses = append(l.Parses, 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
|
var errors []string
|
||||||
if len(meta.FailedPaths) > 0 {
|
if len(meta.FailedPaths) > 0 {
|
||||||
errors = append(errors, fmt.Sprintf("Failed paths: %v", meta.FailedPaths))
|
errors = append(errors, fmt.Sprintf("Failed paths: %v", meta.FailedPaths))
|
||||||
|
|||||||
Reference in New Issue
Block a user