...

Source file src/edge-infra.dev/pkg/sds/remoteaccess/authserver/logger.go

Documentation: edge-infra.dev/pkg/sds/remoteaccess/authserver

     1  package authserver
     2  
     3  import (
     4  	"os"
     5  
     6  	"edge-infra.dev/pkg/lib/fog"
     7  
     8  	"github.com/gin-contrib/requestid"
     9  	"github.com/gin-gonic/gin"
    10  )
    11  
    12  func newLogger(as *AuthServer) {
    13  	if as.GinMode == gin.DebugMode {
    14  		as.Log = fog.New(fog.To(os.Stdout), fog.WithLevel(fog.DEBUG))
    15  		return
    16  	}
    17  	as.Log = fog.New()
    18  }
    19  
    20  func (as *AuthServer) infoLog(ctx *gin.Context, message string, err error) {
    21  	requestID := requestid.Get(ctx)
    22  	if err != nil {
    23  		as.Log.Info(message, "remote-addr", ctx.Request.RemoteAddr, "reason", err.Error(), "requestId", requestID)
    24  		return
    25  	}
    26  	as.Log.Info(message, "remote-addr", ctx.Request.RemoteAddr, "requestId", requestID)
    27  }
    28  

View as plain text