*: add structured logging

This commit is contained in:
Jimmy Zelinskie
2017-05-06 18:48:44 -04:00
parent 353ba01e51
commit cb55019ab8
6 changed files with 81 additions and 11 deletions

View File

@@ -52,6 +52,15 @@ type Config struct {
ShardCount int `yaml:"shard_count"`
}
// LogFields renders the current config as a set of Logrus fields.
func (cfg Config) LogFields() log.Fields {
return log.Fields{
"gcInterval": cfg.GarbageCollectionInterval,
"peerLifetime": cfg.PeerLifetime,
"shardCount": cfg.ShardCount,
}
}
// New creates a new PeerStore backed by memory.
func New(cfg Config) (storage.PeerStore, error) {
shardCount := 1