Skip to content

Commit

Permalink
Use noop logger for pebble
Browse files Browse the repository at this point in the history
  • Loading branch information
Maelkum committed Oct 5, 2023
1 parent afc761f commit fa08d6c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func run() int {
cfg.Workspace = workspace

// Open the pebble peer database.
pdb, err := pebble.Open(cfg.PeerDatabasePath, &pebble.Options{})
pdb, err := pebble.Open(cfg.PeerDatabasePath, &pebble.Options{Logger: &pebbleNoopLogger{}})
if err != nil {
log.Error().Err(err).Str("db", cfg.PeerDatabasePath).Msg("could not open pebble peer database")
return failure
Expand Down Expand Up @@ -168,7 +168,7 @@ func run() int {
}

// Open the pebble function database.
fdb, err := pebble.Open(cfg.FunctionDatabasePath, &pebble.Options{})
fdb, err := pebble.Open(cfg.FunctionDatabasePath, &pebble.Options{Logger: &pebbleNoopLogger{}})
if err != nil {
log.Error().Err(err).Str("db", cfg.FunctionDatabasePath).Msg("could not open pebble function database")
return failure
Expand Down
7 changes: 7 additions & 0 deletions cmd/node/pebble_noop_logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

type pebbleNoopLogger struct{}

func (p *pebbleNoopLogger) Infof(_ string, _ ...any) {}

func (p *pebbleNoopLogger) Fatalf(_ string, _ ...any) {}
2 changes: 1 addition & 1 deletion models/execute/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type ResultAggregation struct {
type Attributes struct {
// Values specify which attributes the node in question should have.
// At the moment we support strict equality only, so no `if RAM >= 16GB` types of conditions.
Values []Parameter `json:"attributes,omitempty"`
Values []Parameter `json:"values,omitempty"`

// Should we accept nodes whose attributes are not attested?
AttestationRequired bool `json:"attestation_required,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func New(log zerolog.Logger, host *host.Host, peerStore PeerStore, fstore FStore
}

n.attributes = &attributes
n.log.Info().Interface("attributes", n.attributes).Msg("node loaded attributes")
}

err := n.ValidateConfig()
Expand Down

0 comments on commit fa08d6c

Please sign in to comment.