Open emptyhua opened 5 years ago
package main import ( "github.com/ccding/go-logging/logging" ) type Resp struct { Msg string } func main() { logger, _ := logging.SimpleLogger("main") resp := &Resp{"hello"} logger.Errorf("resp=%+v", resp) resp.Msg = "world" logger.Errorf("resp=%+v", resp) logger.Destroy() }
output:
main [ ERROR] 2018-08-27 16:23:41.796996122 - resp=&{Msg:world} main [ ERROR] 2018-08-27 16:23:41.797058713 - resp=&{Msg:world}
the first mesage shoud be resp=&{Msg:hello}
resp=&{Msg:hello}
in async mode, this is not guaranteed.
output:
the first mesage shoud be
resp=&{Msg:hello}