Beispiel #1
0
func (c debugRwc) Read(b []byte) (n int, err error) {
	fmt.Printf("[debugConn] [%s] %s Read Start len: %d\n", kmgTime.MysqlUsNowFromDefaultNower(), c.Name, len(b))
	n, err = c.ReadWriteCloser.Read(b)
	if err != nil {
		if c.showData {
			fmt.Printf("[debugConn] [%s] %s Read finish iLen: %d oLen: %d err: %s content: %#v\n", kmgTime.MysqlUsNowFromDefaultNower(), c.Name, len(b), n, err, b[:n])
		} else {
			fmt.Printf("[debugConn] [%s] %s Read finish iLen: %d oLen: %d err: %s\n", kmgTime.MysqlUsNowFromDefaultNower(), c.Name, len(b), n, err)
		}
	} else {
		if c.showData {
			fmt.Printf("[debugConn] [%s] %s Read finish iLen: %d oLen: %d content: %#v\n", kmgTime.MysqlUsNowFromDefaultNower(), c.Name, len(b), n, b[:n])
		} else {
			fmt.Printf("[debugConn] [%s] %s Read finish iLen: %d oLen: %d\n", kmgTime.MysqlUsNowFromDefaultNower(), c.Name, len(b), n)
		}
	}
	return n, err
}
Beispiel #2
0
func (c debugRwc) Close() (err error) {
	fmt.Println("[debugConn]", "["+kmgTime.MysqlUsNowFromDefaultNower()+"]", c.Name, "Close start err:", err)
	err = c.ReadWriteCloser.Close()
	fmt.Println("[debugConn]", "["+kmgTime.MysqlUsNowFromDefaultNower()+"]", c.Name, "Close finish err:", err)
	return err
}