When a well plan dictates the drilling of a straight borehole, surveys are periodically taken to ensure that it will hit its target and also to ensure that it does not trespass underneath different property lines. These surveys can be taken fairly simply with a mechanical drift recorder more commonly known as a Totco or Totco barrel (named after the company that perfected the device). This device is run inside the drill string attached to a wire on a wireline unit, down to the bottom of the drill pipe where the device (which is simply an inverted pendulum with a timer that punches a pin-hole onto a round paper tab delineated with concentric circles indicating increments of degrees) measures the angle of the hole and then is pulled back out to visually inspect to determine the angle. There are versions of this device that actually take a picture on film and are often used in situations where the azimuth (direction) needs to be determined also.
When a well plan dictates a directional or horizontal borehole, more sophisticated tools are normally used. One such tool is the MWD (measurement while drilling) tool that uses electronic accelerometers and gyroscopes, to continually take surveys while drilling (as the name suggests) and also measures the azimuth (direction). This tool is attached to the drill string itself and requires extra support personnel to use and interpret the data, and its costs are much more substantial. (See well logging)