Skip to content

Instantly share code, notes, and snippets.

@nilium
Created August 18, 2015 14:39
Show Gist options
  • Save nilium/50dccf2bfd5224a6ec06 to your computer and use it in GitHub Desktop.
Save nilium/50dccf2bfd5224a6ec06 to your computer and use it in GitHub Desktop.
type glogWriter func(...interface{})
func (fn glogWriter) Write(d []byte) (n int, err error) {
n = len(d)
if fn != nil {
fn(string(d))
}
return n, err
}
func init() {
var w = glogWriter(glog.Infoln)
log.SetOutput(w)
log.SetFlags(0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment