Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit ec6d861

Browse files
MarcPaquetteebroberson
authored andcommitted
Refactor for Zap 0.3 update
1 parent c35a8cd commit ec6d861

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ type RoutingApiConfig struct {
152152

153153
type OAuthConfig struct {
154154
TokenEndpoint string `yaml:"token_endpoint"`
155-
Port uint16 `yaml:"port"`
155+
Port int `yaml:"port"`
156156
SkipSSLValidation bool `yaml:"skip_ssl_validation"`
157157
ClientName string `yaml:"client_name"`
158158
ClientSecret string `yaml:"client_secret"`

config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ oauth:
654654
Expect(err).ToNot(HaveOccurred())
655655

656656
Expect(config.OAuth.TokenEndpoint).To(Equal("uaa.internal"))
657-
Expect(config.OAuth.Port).To(Equal(uint16(8443)))
657+
Expect(config.OAuth.Port).To(Equal(int(8443)))
658658
Expect(config.OAuth.SkipSSLValidation).To(Equal(true))
659659
Expect(config.OAuth.ClientName).To(Equal("client-name"))
660660
Expect(config.OAuth.ClientSecret).To(Equal("client-secret"))

handlers/clientcert_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var _ = Describe("Clientcert", func() {
6464
switch errorCase {
6565
case "forceDeleteError":
6666
Expect(logger.TestSink.Lines()[0]).To(MatchRegexp(
67-
`{"log_level":[0-9]*,"timestamp":[0-9]+[.][0-9]+,"message":"signature-validation-failed","data":{"error":"forceDelete error"}}`,
67+
`{"log_level":[0-9]*,"timestamp":[0-9]+[.][0-9]+,"message":"signature-validation-failed","data":{"error":"forceDelete error"}`,
6868
))
6969
Expect(rw.Code).To(Equal(http.StatusBadGateway))
7070
case "routeServiceTimeout":

integration/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ var _ = Describe("Router Integration", func() {
11151115

11161116
Context("when tls for uaa is disabled", func() {
11171117
It("fails fast", func() {
1118-
cfg.OAuth.Port = 0
1118+
cfg.OAuth.Port = -1
11191119
writeConfig(cfg, cfgFile)
11201120

11211121
gorouterCmd := exec.Command(gorouterPath, "-c", cfgFile)
@@ -1433,12 +1433,12 @@ func uriAndPort(url string) (string, int) {
14331433
return uri, port
14341434
}
14351435

1436-
func hostnameAndPort(url string) (string, uint16) {
1436+
func hostnameAndPort(url string) (string, int) {
14371437
parts := strings.Split(url, ":")
14381438
hostname := parts[0]
14391439
port, err := strconv.ParseUint(parts[1], 10, 16)
14401440
Expect(err).ToNot(HaveOccurred())
1441-
return hostname, uint16(port)
1441+
return hostname, int(port)
14421442
}
14431443

14441444
func newMessageBus(c *config.Config) (*nats.Conn, error) {

logger/lager_adapter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ var _ = Describe("LagerAdapter", func() {
5555
lagerLogger.Info(message)
5656
Expect(testSink.Lines()).To(HaveLen(1))
5757
Expect(testSink.Lines()[0]).To(MatchRegexp(
58-
`{"log_level":[0-9]*,"timestamp":[0-9]+[.][0-9]+,"message":"%s","source":"%s.%s","data":{}}`,
58+
`{"log_level":[0-9]*,"timestamp":[0-9]+[.][0-9]+,"message":"%s","source":"%s.%s"}`,
5959
message,
6060
prefix,
6161
component,
@@ -70,7 +70,7 @@ var _ = Describe("LagerAdapter", func() {
7070
lagerLogger.Info(message)
7171
Expect(testSink.Lines()).To(HaveLen(1))
7272
Expect(testSink.Lines()[0]).To(MatchRegexp(
73-
`{"log_level":[0-9]*,"timestamp":[0-9]+[.][0-9]+,"message":"%s","source":"%s.%s.%s","data":{}}`,
73+
`{"log_level":[0-9]*,"timestamp":[0-9]+[.][0-9]+,"message":"%s","source":"%s.%s.%s"}`,
7474
message,
7575
prefix,
7676
component,

logger/logger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func initializeLogger() *slog.Logger {
126126
conf.level,
127127
)
128128

129-
zapHandler := zapslog.NewHandler(zapCore, &zapslog.HandlerOptions{AddSource: true})
129+
zapHandler := zapslog.NewHandler(zapCore, zapslog.WithCaller(true))
130130
slogFrontend := slog.New(zapHandler)
131131
return slogFrontend
132132
}

logger/logger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ var _ = Describe("Logger", func() {
178178

179179
Expect(testSink.Lines()).To(HaveLen(1))
180180
Expect(testSink.Lines()[0]).To(MatchRegexp(
181-
`{"log_level":3,"timestamp":[0-9]+[.][0-9]+,"message":"%s","data":{"error":"%s"}}`, action, err.Error(),
181+
`{"log_level":3,"timestamp":[0-9]+[.][0-9]+,"message":"%s","data":{"error":"%s"}`, action, err.Error(),
182182
))
183183
})
184184
})

0 commit comments

Comments
 (0)