code: func (w *LogFile) WriteLogEntry(msg *logger.Message) error {
  	b, err := w.marshal(msg)
  	if err != nil {
  		return errors.Wrap(err, "error marshalling log message")
  	}
  
  	logger.PutMessage(msg)
  
  	w.mu.Lock()
  	if w.closed {
  		w.mu.Unlock()
  		return errors.New("cannot write because the output file was closed")
  	}
  
  	if err := w.checkCapacityAndRotate(); err != nil {
  		w.mu.Unlock()
  		return err
  	}
  
  	n, err := w.f.Write(b)
  	if err == nil {
  		w.currentSize += int64(n)
  		w.lastTimestamp = msg.Timestamp
  	}
  	w.mu.Unlock()
  	return err
  }
docs: // WriteLogEntry writes the provided log message to the current log file.
  // This may trigger a rotation event if the max file/capacity limits are hit.