55 "crypto/x509"
66 "fmt"
77 "io"
8- "log"
98 "math/rand"
109 "net/http"
1110 "os"
@@ -15,6 +14,7 @@ import (
1514 "time"
1615
1716 "github.com/getsentry/sentry-go/internal/debug"
17+ "github.com/getsentry/sentry-go/internal/debuglog"
1818)
1919
2020// The identifier of the SDK.
@@ -78,8 +78,8 @@ type usageError struct {
7878}
7979
8080// DebugLogger is an instance of log.Logger that is used to provide debug information about running Sentry Client
81- // can be enabled by either using DebugLogger .SetOutput directly or with Debug client option.
82- var DebugLogger = log . New ( io . Discard , "[Sentry] " , log . LstdFlags )
81+ // can be enabled by either using debuglog .SetOutput directly or with Debug client option.
82+ var DebugLogger = debuglog . GetLogger ( )
8383
8484// EventProcessor is a function that processes an event.
8585// Event processors are used to change an event before it is sent to Sentry.
@@ -296,7 +296,7 @@ func NewClient(options ClientOptions) (*Client, error) {
296296 if debugWriter == nil {
297297 debugWriter = os .Stderr
298298 }
299- DebugLogger .SetOutput (debugWriter )
299+ debuglog .SetOutput (debugWriter )
300300 }
301301
302302 if options .Dsn == "" {
@@ -401,12 +401,12 @@ func (client *Client) setupIntegrations() {
401401
402402 for _ , integration := range integrations {
403403 if client .integrationAlreadyInstalled (integration .Name ()) {
404- DebugLogger .Printf ("Integration %s is already installed\n " , integration .Name ())
404+ debuglog .Printf ("Integration %s is already installed\n " , integration .Name ())
405405 continue
406406 }
407407 client .integrations = append (client .integrations , integration )
408408 integration .SetupOnce (client )
409- DebugLogger .Printf ("Integration installed: %s\n " , integration .Name ())
409+ debuglog .Printf ("Integration installed: %s\n " , integration .Name ())
410410 }
411411
412412 sort .Slice (client .integrations , func (i , j int ) bool {
@@ -647,7 +647,7 @@ func (client *Client) processEvent(event *Event, hint *EventHint, scope EventMod
647647 // options.TracesSampler when they are started. Other events
648648 // (errors, messages) are sampled here. Does not apply to check-ins.
649649 if event .Type != transactionType && event .Type != checkInType && ! sample (client .options .SampleRate ) {
650- DebugLogger .Println ("Event dropped due to SampleRate hit." )
650+ debuglog .Println ("Event dropped due to SampleRate hit." )
651651 return nil
652652 }
653653
@@ -663,15 +663,15 @@ func (client *Client) processEvent(event *Event, hint *EventHint, scope EventMod
663663 case transactionType :
664664 if client .options .BeforeSendTransaction != nil {
665665 if event = client .options .BeforeSendTransaction (event , hint ); event == nil {
666- DebugLogger .Println ("Transaction dropped due to BeforeSendTransaction callback." )
666+ debuglog .Println ("Transaction dropped due to BeforeSendTransaction callback." )
667667 return nil
668668 }
669669 }
670670 case checkInType : // not a default case, since we shouldn't apply BeforeSend on check-in events
671671 default :
672672 if client .options .BeforeSend != nil {
673673 if event = client .options .BeforeSend (event , hint ); event == nil {
674- DebugLogger .Println ("Event dropped due to BeforeSend callback." )
674+ debuglog .Println ("Event dropped due to BeforeSend callback." )
675675 return nil
676676 }
677677 }
@@ -738,7 +738,7 @@ func (client *Client) prepareEvent(event *Event, hint *EventHint, scope EventMod
738738 id := event .EventID
739739 event = processor (event , hint )
740740 if event == nil {
741- DebugLogger .Printf ("Event dropped by one of the Client EventProcessors: %s\n " , id )
741+ debuglog .Printf ("Event dropped by one of the Client EventProcessors: %s\n " , id )
742742 return nil
743743 }
744744 }
@@ -747,7 +747,7 @@ func (client *Client) prepareEvent(event *Event, hint *EventHint, scope EventMod
747747 id := event .EventID
748748 event = processor (event , hint )
749749 if event == nil {
750- DebugLogger .Printf ("Event dropped by one of the Global EventProcessors: %s\n " , id )
750+ debuglog .Printf ("Event dropped by one of the Global EventProcessors: %s\n " , id )
751751 return nil
752752 }
753753 }
0 commit comments