influxdb/telemetry/store.go

33 lines
602 B
Go
Raw Normal View History

2019-01-20 20:10:40 +00:00
package telemetry
import (
"context"
"go.uber.org/zap"
)
// Store records usage data.
type Store interface {
// WriteMessage stores data into the store.
WriteMessage(ctx context.Context, data []byte) error
}
var _ Store = (*LogStore)(nil)
// LogStore logs data written to the store.
type LogStore struct {
log *zap.Logger
}
func NewLogStore(log *zap.Logger) *LogStore {
return &LogStore{
log: log,
}
2019-01-20 20:10:40 +00:00
}
// WriteMessage logs data at Info level.
func (s *LogStore) WriteMessage(ctx context.Context, data []byte) error {
s.log.Info("Write", zap.String("data", string(data)))
2019-01-20 20:10:40 +00:00
return nil
}