// +build glslogid package log import ( "fmt" "github.com/tylerb/gls" ) type glsLogidCreator struct { idkey string } func (creator *glsLogidCreator) GetLogid() string { id := gls.Get(creator.idkey) if id == nil { return "" } if logid, ok := id.(string); ok { return logid } else { return fmt.Sprintf("%s", id) } } func (creator *glsLogidCreator) SetLogid(logid string) { gls.Set(creator.idkey, logid) } func (creator *glsLogidCreator) Cleanup() { gls.Cleanup() } func init() { idc := &glsLogidCreator{ idkey: "logidkey", } RegisterLogidCreator(idc) }