Skip to content

Commit

Permalink
Merge pull request #72 from xataio/update-logger-field
Browse files Browse the repository at this point in the history
Update logger field
  • Loading branch information
eminano authored Sep 13, 2024
2 parents 5a6115a + 3f1d8f8 commit accab0d
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: check-executables-have-shebangs
- id: check-merge-conflict
- repo: https://github.com/golangci/golangci-lint
rev: v1.58.1
rev: v1.60.1
hooks:
- id: golangci-lint-full
args: ["--timeout=10m", "--config=.golangci.yml"]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: lint
lint: ## Lint source code
@echo "Linting source code..."
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.1
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.1
@golangci-lint run

.PHONY: test
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (l *NoopLogger) WithFields(fields Fields) Logger {
return l
}

const ServiceField = "service"
const ModuleField = "module"

func NewNoopLogger() *NoopLogger {
return &NoopLogger{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/checkpointer/kafka/wal_kafka_checkpointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func New(ctx context.Context, cfg Config, committer kafkaCommitter, opts ...Opti
func WithLogger(l loglib.Logger) Option {
return func(c *Checkpointer) {
c.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "wal_kafka_checkpointer",
loglib.ModuleField: "wal_kafka_checkpointer",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/listener/kafka/wal_kafka_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewWALReader(kafkaReader kafkaReader, processRecord payloadProcessor, opts
func WithLogger(logger loglib.Logger) Option {
return func(r *Reader) {
r.logger = loglib.NewLogger(logger).WithFields(loglib.Fields{
loglib.ServiceField: "wal_kafka_reader",
loglib.ModuleField: "wal_kafka_reader",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/listener/postgres/wal_pg_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func New(handler replicationHandler, processEvent listenerProcessWalEvent, opts
func WithLogger(logger loglib.Logger) Option {
return func(l *Listener) {
l.logger = loglib.NewLogger(logger).WithFields(loglib.Fields{
loglib.ServiceField: "wal_postgres_listener",
loglib.ModuleField: "wal_postgres_listener",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/kafka/wal_kafka_batch_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func NewBatchWriter(config *Config, opts ...Option) (*BatchWriter, error) {
func WithLogger(l loglib.Logger) Option {
return func(w *BatchWriter) {
w.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "kafka_batch_writer",
loglib.ModuleField: "kafka_batch_writer",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/search/search_batch_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func NewBatchIndexer(ctx context.Context, config IndexerConfig, store Store, lsn
func WithLogger(l loglib.Logger) Option {
return func(i *BatchIndexer) {
i.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "search_batch_indexer",
loglib.ModuleField: "search_batch_indexer",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/translator/wal_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func WithSkipDataEvent(skip dataEventFilter) Option {
func WithLogger(l loglib.Logger) Option {
return func(t *Translator) {
t.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "wal_translator",
loglib.ModuleField: "wal_translator",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/processor/webhook/notifier/webhook_notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func New(cfg *Config, store subscriptionRetriever, opts ...Option) *Notifier {
func WithLogger(l loglib.Logger) Option {
return func(n *Notifier) {
n.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "webhook_notifier",
loglib.ModuleField: "webhook_notifier",
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func New(cfg *Config, store store.Store, opts ...Option) *Server {
func WithLogger(l loglib.Logger) Option {
return func(s *Server) {
s.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "webhook_subscription_server",
loglib.ModuleField: "webhook_subscription_server",
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func New(ctx context.Context, store store.Store, cfg *Config, opts ...Option) (*
func WithLogger(l loglib.Logger) Option {
return func(sc *Store) {
sc.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "subscription_store_cache",
loglib.ModuleField: "subscription_store_cache",
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewSubscriptionStore(ctx context.Context, url string, opts ...Option) (*Sto
func WithLogger(l loglib.Logger) Option {
return func(ss *Store) {
ss.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "webhook_subscription_store",
loglib.ModuleField: "webhook_subscription_store",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/wal/replication/postgres/pg_replication_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func NewHandler(ctx context.Context, cfg Config, opts ...Option) (*Handler, erro
func WithLogger(l loglib.Logger) Option {
return func(h *Handler) {
h.logger = loglib.NewLogger(l).WithFields(loglib.Fields{
loglib.ServiceField: "postgres_replication_handler",
loglib.ModuleField: "postgres_replication_handler",
})
}
}
Expand Down

0 comments on commit accab0d

Please sign in to comment.