Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more log fixes #173

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/image-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:

jobs:

build-and-push-ssi:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
12 changes: 5 additions & 7 deletions impl/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ import (
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
func main() {
logrus.SetFormatter(&logrus.JSONFormatter{
PrettyPrint: true,
})
logrus.SetFormatter(&logrus.JSONFormatter{})
logrus.SetReportCaller(true)

log := logrus.NewEntry(logrus.StandardLogger()).WithField("version", config.Version)
Expand All @@ -47,7 +45,7 @@ func main() {
func run() error {
ctx := context.Background()
if err := telemetry.SetupTelemetry(ctx); err != nil {
logrus.WithError(err).Fatal("error initializing telemetry")
logrus.WithContext(ctx).WithError(err).Fatal("error initializing telemetry")
}
defer telemetry.Shutdown(ctx)

Expand All @@ -68,7 +66,7 @@ func run() error {
if logFile := configureLogger(cfg.Log.Level, cfg.Log.Path); logFile != nil {
defer func(logFile *os.File) {
if err = logFile.Close(); err != nil {
logrus.WithError(err).Error("failed to close log file")
logrus.WithContext(ctx).WithError(err).Error("failed to close log file")
}
}(logFile)
}
Expand All @@ -80,12 +78,12 @@ func run() error {

d, err := dht.NewDHT(cfg.DHTConfig.BootstrapPeers)
if err != nil {
return util.LoggingErrorMsg(err, "failed to instantiate dht")
return util.LoggingCtxErrorMsg(ctx, err, "failed to instantiate dht")
}

s, err := server.NewServer(cfg, shutdown, d)
if err != nil {
return util.LoggingErrorMsg(err, "could not start http services")
return util.LoggingCtxErrorMsg(ctx, err, "could not start http services")
}

serverErrors := make(chan error, 1)
Expand Down
6 changes: 3 additions & 3 deletions impl/internal/cli/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const (
// Read reads the diddht file and returns the identities.
func Read() (internal.Identities, error) {
homeDir, _ := os.UserHomeDir()
diddhtFile := homeDir + didDHTPath
if _, err := os.Stat(diddhtFile); os.IsNotExist(err) {
didDHTFile := homeDir + didDHTPath
if _, err := os.Stat(didDHTFile); os.IsNotExist(err) {
return nil, util.LoggingErrorMsg(err, "failed to find diddht file")
}
f, _ := os.Open(diddhtFile)
f, _ := os.Open(didDHTFile)
defer f.Close()
var identities internal.Identities
if err := json.NewDecoder(f).Decode(&identities); err != nil {
Expand Down
Loading