I'm buying gear to start recording guitar at home and I'm stuck between using my guitar directly into the audio interface or use a mic for the cab. I've been reading that using a mic would get you better quality but is it much superior then going with the guitar directly into the interface?

The problem is I live near a busy road and even with the house fully closed off you can still hear outside noises and cars passing. Would you be able to hear all the background noise in a recording?

what would be the better option?
Electric or acoustic?

For electric guitar, noise barely matters since you use less sensitive mics very close to the guitar amp.

And to be honest, the quality of an interface (with free plugins) is usually better unless you have a very nice amp and good enough engineering skills to mic it correctly. It's more complicated though.

Acoustic is a whole different beast, of course.
Its for electric guitar. Well I can get the Interface and then if I find I need a mic.. get that one later.
Even if you live on a noisy road, making the right mic choice can make all the difference. Purchasing a condenser mic will give excellent results with the right acoustic guitar, but will pick up the soft sound of a mosquito farting at 50 feet. A dynamic mic, on the other hand, will still produce very good results, but can be made to be directional, so that noise behind it is in the null zone and not picked up. Both of these ideas also apply to vocals. Another thing to remember is that nearby road noise will tend to be drowned out, when you have the mic in close proximity of the guitar cab.

You don't always need expensive amps to record electric guitars. Honestly, some of the largest recording acts have used downright cheap and small amplifiers for a big sound - Eric Clapton, for one. Remember, small amps record big sound!

As Kyle mentioned, the quality of your recording interface also makes a big difference. Set a budget and buy the best gear you can afford.
I live right next to a main road and I never have problems with cars appearing on my music. I record with my SM57 for electric guitar, acoustic guitar and vocals (only mic I own... so far) and I never even think about placement, relative to the road noise. Presumably I'm loud enough and I mic close enough that even if something did go past when recording, it doesn't really come through at all. If you can, you'd do well to record around less busy times, rather than, say, rush hour.

To answer your question, you'll probably be fine with a mic
Rotten Playground
Listen to me and Jameh muck about on a podcast
as if you have anything better to do.

Quote by Reverend_Taco
Grass stains on my dicks

Quote by T00DEEPBLUE
Pfft. Gay? Nah, gay is the manliest sex that exists.
When I lived in Brooklyn, right on a busy commuter road, I used a bass roll-off on my condenser and that kept all the truck rumblings and neighbors' stomping feet out of my vocal sessions. When I wasn't using the condenser on my amp, I used an SM57 and that never picked up anything nasty. You can always roll off the low rumblings with a high pass shelf EQ afterwards.
Telecaster - SG - Jaguar
Princeton Reverb, Extra Reverb
P-Bass - Mustang Bass
Apogee Duet 2 - Ableton Suite