Skip to content

Commit

Permalink
Merge pull request #653 from thedadams/disable-sdk-server-err-log
Browse files Browse the repository at this point in the history
feat: add ability to disable server error logging
  • Loading branch information
thedadams authored Jul 22, 2024
2 parents 30bb65a + 78b02e3 commit 84b2aa3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/sdkserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"log"
"net"
"net/http"
"os"
Expand All @@ -24,8 +25,9 @@ import (
type Options struct {
gptscript.Options

ListenAddress string
Debug bool
ListenAddress string
Debug bool
DisableServerErrorLogging bool
}

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

if opts.DisableServerErrorLogging {
httpServer.ErrorLog = log.New(io.Discard, "", 0)
}

logger := mvl.Package()
done := make(chan struct{})
context.AfterFunc(ctx, func() {
Expand Down

0 comments on commit 84b2aa3

Please sign in to comment.