Flying-Tom commented on PR #2832:
URL: https://github.com/apache/dubbo-go/pull/2832#issuecomment-2801962510

   ```go
   package main
   
   import (
        "context"
        "time"
   
        "dubbo.apache.org/dubbo-go/v3"
        "dubbo.apache.org/dubbo-go/v3/protocol"
   
        _ "dubbo.apache.org/dubbo-go/v3/imports"
        glog "github.com/dubbogo/gost/log/logger"
   
        "dubbo.apache.org/dubbo-go/v3/logger"
   )
   
   func main() {
        ins, err := dubbo.NewInstance(
                dubbo.WithProtocol(
                        protocol.WithTriple(),
                        protocol.WithPort(20000),
                ),
                dubbo.WithLogger(
                        logger.WithLevel("info"),
                        logger.WithZap(),
                ),
        )
        // some logic
        logger.SetLoggerLevel("debug")
   
        if err != nil {
                panic(err)
        }
        server, err := ins.NewServer()
        if err != nil {
                panic(err)
        }
        go server.Serve()
        ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
        defer cancel()
        for {
                select {
                case <-ctx.Done():
                        return
                default:
                        glog.Info("hello dubbogo this is info log")
                        glog.Debug("hello dubbogo this is debug log")
                        glog.Warn("hello dubbogo this is warn log")
                        time.Sleep(time.Second * 1)
                }
        }
   }
   
   ```
   
   Here is the sample code. From my perspective, the `logger` is better to be 
`dubbo.apache.org/dubbo-go/v3/logger` instead of 
`github.com/dubbogo/gost/log/logger`. (ambiguity with same name)
   
   `gost` is a stable (or stale) sdk which has not been updated for 2 years, so 
this PR is trying to limit the modification in `dubbo-go`, avoiding updating 
`github.com/dubbogo/gost/log/logger`.


-- 
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: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to