Flying-Tom opened a new pull request, #2838:
URL: https://github.com/apache/dubbo-go/pull/2838

   #2526 add SetLoggerLevel for logger module, logger options can be modified 
by this function as follow.
   
   ```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"
        "github.com/dubbogo/gost/log/logger"
   
        log "dubbo.apache.org/dubbo-go/v3/logger"
   )
   
   func main() {
        ins, err := dubbo.NewInstance(
                dubbo.WithProtocol(
                        protocol.WithTriple(),
                        protocol.WithPort(20000),
                ),
                dubbo.WithLogger(
                        log.WithLevel("warn"),
                        log.WithZap(),
                ),
        )
        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:
                        logger.Info("hello dubbogo this is info log")
                        logger.Debug("hello dubbogo this is debug log")
                        logger.Warn("hello dubbogo this is warn log")
                        time.Sleep(time.Second * 1)
                }
        }
   }
   
   ```


-- 
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