@@ -45,8 +45,9 @@ Once the feature is enabled on the SDK and the SDK is initialized, you can send
4545the ` sentry.Logger ` API.
4646
4747The ` Sentry.Logger ` API exposes methods that support six different log levels: ` trace ` ,
48- ` debug ` , ` info ` , ` warn ` , ` error ` and ` fatal ` . The methods support both ` fmt.Print ` and ` fmt.Println ` like syntax. Using
49- these methods is as simple as:
48+ ` debug ` , ` info ` , ` warn ` , ` error ` and ` fatal ` . The methods support both ` fmt.Print ` and ` fmt.Printf ` like syntax.
49+ If you pass in format specifiers like ` %v ` , these will be sent to Sentry, and can be searched from within the Logs UI,
50+ and even added to the Logs views as a dedicated column.
5051
5152``` go
5253ctx := context.Background ()
@@ -57,8 +58,7 @@ logger.Info(ctx, "Hello ", "world!")
5758// Or like [fmt.Printf]
5859logger.Infof (ctx, " Hello %v !" , " world" )
5960```
60- Additionally, you can attach properties to each log entry using the ` attribute ` API. These properties will be sent
61- to Sentry, and can be searched from within the Logs UI, and even added to the Logs views as a dedicated column.
61+ You can also pass additional attributes to the logger via the ` SetAttributes ` function. These attributes will also be searchable in the Logs UI.
6262
6363``` go
6464package main
@@ -108,9 +108,9 @@ slogger.Info("Implementing slog.Logger")
108108```
109109
110110<Alert >
111- However in order to properly attach the correct Spans with each Log entry, a ` context.Context ` is required. The ` Write ` function of
112- the ` io.Writer ` interface does not provide ` context ` so currently wrapping the custom logger will provide limited functionality .
113- The recommended way is to use the ` sentry.Logger ` itself .
111+ In order to properly attach the correct trace with each Log entry, a ` context.Context ` is required. The ` Write ` function of
112+ the ` io.Writer ` interface does not provide ` context ` so wrapping the custom logger will not get the trace and current span attached .
113+ We recommend using the ` sentry.Logger ` to ensure your logs are connected to spans and errors in the Sentry UI .
114114</Alert >
115115
116116## Options
@@ -140,4 +140,4 @@ if err := sentry.Init(sentry.ClientOptions{
140140
141141### Debug
142142
143- If debug is set to true, calls to the logger will also print to the console with the appropriate log level.
143+ If the ` Debug ` init option is set to true, calls to the ` sentry.Logger ` will also print to the console with the appropriate log level.
0 commit comments