Covariant formulation of classical electromagnetism