From 71c0440deab0cafeaf64389019087f07a2876c1b Mon Sep 17 00:00:00 2001 From: kc Date: Wed, 17 Jul 2024 15:24:47 +0000 Subject: [PATCH] remove println which breaks json parsing --- config/policy.go | 4 +++- session.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/policy.go b/config/policy.go index 21168158..2e933600 100644 --- a/config/policy.go +++ b/config/policy.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" + "github.com/inconshreveable/log15" "gopkg.in/yaml.v3" po "golang.ngrok.com/ngrok/policy" @@ -77,7 +78,8 @@ func (p *policy) ApplyTCP(opts *tcpOptions) { // policyToString converts the policy into a JSON string representation. This is to help remap Policy to TrafficPolicy. func policyToString(p *policy) string { - fmt.Println("WithPolicy has been deprecated. Please use WithPolicyString instead, as WithPolicy will stop working soon.") + logger := log15.New() + logger.Warn("WithPolicy has been deprecated. Please use WithPolicyString instead, as WithPolicy will stop working soon.") val, err := json.Marshal(p) if err != nil { diff --git a/session.go b/session.go index 9f527050..5688a9bc 100644 --- a/session.go +++ b/session.go @@ -920,7 +920,7 @@ func (s *sessionImpl) ListenAndServeHTTP(ctx context.Context, cfg config.Tunnel, impl.server = server } else { // Inform end user that they're using a deprecated option. - fmt.Println("Tunnel is serving an HTTP server via HTTP options. This has been deprecated. Please use Session.ListenAndServeHTTP instead.") + s.inner().Logger.Warn("Tunnel is serving an HTTP server via HTTP options. This has been deprecated. Please use Session.ListenAndServeHTTP instead.") } }