MrSibe commented on PR #3195:
URL: https://github.com/apache/dubbo-go/pull/3195#issuecomment-3859822971

   ## Usage
   
   ### Old API
   
   ```go
   config.NewLoggerConfigBuilder().
       SetDriver("zap").
       SetTraceIntegrationEnabled(true).
       SetRecordErrorToSpan(true).
       Build()
   ```
   
   ### New API
   
   ```go
   logger.NewOptions(
       logger.WithZap(),
       logger.WithTraceIntegration(true),
       logger.WithRecordErrorToSpan(true),
   )
   ```
   
   ### YAML config
   
   ```yaml
   dubbo:
     logger:
       driver: zap
       trace-integration:
         enabled: true
         record-error-to-span: true
   ```
   
   ### Logging with CtxLogger
   
   ```go
   // get logger
   log := logger.GetLogger().(logger.CtxLogger)
   
   // log with context
   log.CtxInfo(ctx, "message")
   log.CtxInfof(ctx, "user: %s", name)
   log.CtxError(ctx, "error")
   log.CtxErrorf(ctx, "failed: %v", err)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to