Skip to content

Commit 84b2aa3

Browse files
authored
Merge pull request #653 from thedadams/disable-sdk-server-err-log
feat: add ability to disable server error logging
2 parents 30bb65a + 78b02e3 commit 84b2aa3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/sdkserver/server.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"io"
8+
"log"
89
"net"
910
"net/http"
1011
"os"
@@ -24,8 +25,9 @@ import (
2425
type Options struct {
2526
gptscript.Options
2627

27-
ListenAddress string
28-
Debug bool
28+
ListenAddress string
29+
Debug bool
30+
DisableServerErrorLogging bool
2931
}
3032

3133
// Run will start the server and block until the server is shut down.
@@ -121,6 +123,10 @@ func run(ctx context.Context, listener net.Listener, opts Options) error {
121123
),
122124
}
123125

126+
if opts.DisableServerErrorLogging {
127+
httpServer.ErrorLog = log.New(io.Discard, "", 0)
128+
}
129+
124130
logger := mvl.Package()
125131
done := make(chan struct{})
126132
context.AfterFunc(ctx, func() {

0 commit comments

Comments
 (0)