github.com/xraypb/xray-core@v1.6.6/transport/internet/quic/qlogWriter.go (about)

     1  package quic
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/xraypb/xray-core/common/log"
     7  )
     8  
     9  type QlogWriter struct {
    10  	connID []byte
    11  }
    12  
    13  func (w *QlogWriter) Write(b []byte) (int, error) {
    14  	if len(b) > 1 { // skip line separator "0a" in qlog
    15  		log.Record(&log.GeneralMessage{
    16  			Severity: log.Severity_Debug,
    17  			Content:  fmt.Sprintf("[%x] %s", w.connID, b),
    18  		})
    19  	}
    20  	return len(b), nil
    21  }
    22  
    23  func (w *QlogWriter) Close() error {
    24  	// Noop
    25  	return nil
    26  }