code: func (l *Logger) Write(p []byte) (n int, err error) {
  	l.mu.Lock()
  	defer l.mu.Unlock()
  
  	writeLen := int64(len(p))
  	if writeLen > l.max() {
  		return 0, fmt.Errorf(
  			"write length %d exceeds maximum file size %d", writeLen, l.max(),
  		)
  	}
  
  	if l.file == nil {
  		if err = l.openExistingOrNew(len(p)); err != nil {
  			return 0, err
  		}
  	}
  
  	if l.size+writeLen > l.max() {
  		if err := l.rotate(); err != nil {
  			return 0, err
  		}
  	}
  
  	n, err = l.file.Write(p)
  	l.size += int64(n)
  
  	return n, err
  }
docs: // Write implements io.Writer.  If a write would cause the log file to be larger
  // than MaxSize, the file is closed, renamed to include a timestamp of the
  // current time, and a new log file is created using the original log file name.
  // If the length of the write is greater than MaxSize, an error is returned.