Skip to content

Commit

Permalink
Switch logger.NewOCRWrapper to relaylogger.NewOCRWrapper (smartcontra…
Browse files Browse the repository at this point in the history
  • Loading branch information
george-dorin authored Jun 15, 2023
1 parent 27175fe commit fee53a2
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 119 deletions.
62 changes: 0 additions & 62 deletions core/logger/ocr_wrapper.go

This file was deleted.

51 changes: 0 additions & 51 deletions core/logger/ocr_wrapper_test.go

This file was deleted.

1 change: 1 addition & 0 deletions core/services/feeds/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ type OCR2Config interface {
ContractPollInterval() time.Duration
ContractTransmitterTransmitTimeout() time.Duration
DatabaseTimeout() time.Duration
TraceLogging() bool
}
8 changes: 4 additions & 4 deletions core/services/ocr2/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,12 @@ func (d *Delegate) ServicesForSpec(jb job.Job) ([]job.ServiceCtx, error) {
"jobName", jb.Name.ValueOrZero(),
"jobID", jb.ID,
)
vrfLogger := logger.NewOCRWrapper(l.With(
"vrfContractID", spec.ContractID), true, func(msg string) {
vrfLogger := relaylogger.NewOCRWrapper(l.With(
"vrfContractID", spec.ContractID), d.cfg.OCR2().TraceLogging(), func(msg string) {
lggr.ErrorIf(d.jobORM.RecordError(jb.ID, msg), "unable to record error")
})
dkgLogger := logger.NewOCRWrapper(l.With(
"dkgContractID", cfg.DKGContractAddress), true, func(msg string) {
dkgLogger := relaylogger.NewOCRWrapper(l.With(
"dkgContractID", cfg.DKGContractAddress), d.cfg.OCR2().TraceLogging(), func(msg string) {
lggr.ErrorIf(d.jobORM.RecordError(jb.ID, msg), "unable to record error")
})
dkgReportingPluginFactoryDecorator := func(wrapped ocr2types.ReportingPluginFactory) ocr2types.ReportingPluginFactory {
Expand Down
3 changes: 2 additions & 1 deletion core/services/ocr2/plugins/functions/reporting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/smartcontractkit/libocr/commontypes"
"github.com/smartcontractkit/libocr/offchainreporting2plus/types"

relaylogger "github.com/smartcontractkit/chainlink-relay/pkg/logger"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/logger"
functions_srv "github.com/smartcontractkit/chainlink/v2/core/services/functions"
Expand All @@ -22,7 +23,7 @@ import (

func preparePlugin(t *testing.T, batchSize uint32) (types.ReportingPlugin, *functions_mocks.ORM, *encoding.ReportCodec) {
lggr := logger.TestLogger(t)
ocrLogger := logger.NewOCRWrapper(lggr, true, func(msg string) {})
ocrLogger := relaylogger.NewOCRWrapper(lggr, true, func(msg string) {})
orm := functions_mocks.NewORM(t)
factory := functions.FunctionsReportingPluginFactory{
Logger: ocrLogger,
Expand Down
1 change: 1 addition & 0 deletions core/services/ocr2/validate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type OCR2Config interface {
ContractPollInterval() time.Duration
ContractTransmitterTransmitTimeout() time.Duration
DatabaseTimeout() time.Duration
TraceLogging() bool
}

type InsecureConfig interface {
Expand Down
3 changes: 2 additions & 1 deletion core/services/ocrbootstrap/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
ocr "github.com/smartcontractkit/libocr/offchainreporting2plus"
"github.com/smartcontractkit/sqlx"

relaylogger "github.com/smartcontractkit/chainlink-relay/pkg/logger"
"github.com/smartcontractkit/chainlink-relay/pkg/loop"
"github.com/smartcontractkit/chainlink-relay/pkg/types"

Expand Down Expand Up @@ -115,7 +116,7 @@ func (d *Delegate) ServicesForSpec(jobSpec job.Job) (services []job.ServiceCtx,
ContractConfigTracker: configProvider.ContractConfigTracker(),
Database: NewDB(d.db.DB, spec.ID, lggr),
LocalConfig: lc,
Logger: logger.NewOCRWrapper(lggr.Named("OCRBootstrap"), true, func(msg string) {
Logger: relaylogger.NewOCRWrapper(lggr.Named("OCRBootstrap"), d.ocr2Cfg.TraceLogging(), func(msg string) {
logger.Sugared(lggr).ErrorIf(d.jobORM.RecordError(jobSpec.ID, msg), "unable to record error")
}),
OffchainConfigDigester: configProvider.OffchainConfigDigester(),
Expand Down

0 comments on commit fee53a2

Please sign in to comment.