Skip to content

Commit

Permalink
Added logger bridge to IABTechLab logger (#2333)
Browse files Browse the repository at this point in the history
  • Loading branch information
VeronikaSolovei9 authored Aug 8, 2022
1 parent cdbd8be commit eb087f1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
38 changes: 38 additions & 0 deletions experiment/adscert/SignerLogger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package adscert

import (
"fmt"
"github.com/golang/glog"
)

type SignerLogger struct {
}

func (sl *SignerLogger) Debugf(format string, args ...interface{}) {
//there is no Debug level in glog
glog.Infof(format, args...)
}

func (sl *SignerLogger) Infof(format string, args ...interface{}) {
glog.Infof(format, args...)
}

func (sl *SignerLogger) Info(format string) {
glog.Info(format)
}

func (sl *SignerLogger) Warningf(format string, args ...interface{}) {
glog.Warningf(format, args...)
}

func (sl *SignerLogger) Errorf(format string, args ...interface{}) {
glog.Errorf(format, args...)
}

func (sl *SignerLogger) Fatalf(format string, args ...interface{}) {
glog.Fatalf(format, args...)
}

func (sl *SignerLogger) Panicf(format string, args ...interface{}) {
panic(fmt.Sprintf(format, args...))
}
2 changes: 2 additions & 0 deletions experiment/adscert/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package adscert
import (
"fmt"
"github.com/IABTechLab/adscert/pkg/adscert/api"
"github.com/IABTechLab/adscert/pkg/adscert/logger"
"github.com/IABTechLab/adscert/pkg/adscert/signatory"
"github.com/prebid/prebid-server/config"
)
Expand All @@ -22,6 +23,7 @@ func (ns *NilSigner) Sign(destinationURL string, body []byte) (string, error) {
}

func NewAdCertsSigner(experimentAdCertsConfig config.ExperimentAdsCert) (Signer, error) {
logger.SetLoggerImpl(&SignerLogger{})
if experimentAdCertsConfig.Mode == config.AdCertsSignerModeInprocess {
return newInProcessSigner(experimentAdCertsConfig.InProcess)
}
Expand Down

0 comments on commit eb087f1

Please sign in to comment.