code: func (w *Writer) WriteMessage(m *Message) (err error) {
  	mBytes, err := json.Marshal(m)
  	if err != nil {
  		return
  	}
  
  	var zBuf bytes.Buffer
  
  	// . If compression settings have changed, a new writer is required.
  	if w.zwCompressionType != w.CompressionType || w.zwCompressionLevel != w.CompressionLevel {
  		w.zw = nil
  	}
  
  	switch w.CompressionType {
  	case CompressGzip:
  		if w.zw == nil {
  			w.zw, err = gzip.NewWriterLevel(&zBuf, w.CompressionLevel)
  		}
  	case CompressZlib:
  		if w.zw == nil {
  			w.zw, err = zlib.NewWriterLevel(&zBuf, w.CompressionLevel)
  		}
  	case NoCompress:
  		w.zw = &bufferedWriter{}
  	default:
  		panic(fmt.Sprintf("unknown compression type %d",
  			w.CompressionType))
  	}
  
  	if err != nil {
  		return
  	}
  
  	w.zw.Reset(&zBuf)
  
  	if _, err = w.zw.Write(mBytes); err != nil {
  		return
  	}
  	w.zw.Close()
  
  	zBytes := zBuf.Bytes()
  	if numChunks(zBytes) > 1 {
  		return w.writeChunked(zBytes)
  	}
  
  	n, err := w.conn.Write(zBytes)
  	if err != nil {
  		return
  	}
  	if n != len(zBytes) {
  		return fmt.Errorf("bad write (%d/%d)", n, len(zBytes))
  	}
  
  	return nil
  }
docs: // WriteMessage sends the specified message to the GELF server
  // specified in the call to New().  It assumes all the fields are
  // filled out appropriately.  In general, clients will want to use
  // Write, rather than WriteMessage.