mirror of
https://github.com/safing/portbase
synced 2025-09-02 18:50:14 +00:00
Improve logging
This commit is contained in:
parent
74fc1dc888
commit
441f9c45ac
2 changed files with 7 additions and 3 deletions
|
@ -82,7 +82,9 @@ func (reg *ResourceRegistry) LoadIndexes() error {
|
||||||
var firstErr error
|
var firstErr error
|
||||||
for _, idx := range reg.getIndexes() {
|
for _, idx := range reg.getIndexes() {
|
||||||
err := reg.loadIndexFile(idx)
|
err := reg.loadIndexFile(idx)
|
||||||
if err != nil && reg.Online {
|
if err == nil {
|
||||||
|
log.Debugf("%s: loaded index %s", reg.Name, idx.Path)
|
||||||
|
} else if reg.Online {
|
||||||
// try to download the index file if a local disk version
|
// try to download the index file if a local disk version
|
||||||
// does not exist or we don't have permission to read it.
|
// does not exist or we don't have permission to read it.
|
||||||
if os.IsNotExist(err) || os.IsPermission(err) {
|
if os.IsNotExist(err) || os.IsPermission(err) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/safing/portbase/utils"
|
"github.com/safing/portbase/utils"
|
||||||
|
@ -56,7 +55,10 @@ func (reg *ResourceRegistry) downloadIndex(idx Index) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add resources to registry
|
// add resources to registry
|
||||||
_ = reg.AddResources(new, false, idx.Stable, idx.Beta)
|
err = reg.AddResources(new, false, idx.Stable, idx.Beta)
|
||||||
|
if err != nil {
|
||||||
|
log.Warningf("%s: failed to add resources: %s", reg.Name, err)
|
||||||
|
}
|
||||||
|
|
||||||
// save index
|
// save index
|
||||||
err = ioutil.WriteFile(filepath.Join(reg.storageDir.Path, idx.Path), data, 0644)
|
err = ioutil.WriteFile(filepath.Join(reg.storageDir.Path, idx.Path), data, 0644)
|
||||||
|
|
Loading…
Add table
Reference in a new issue