The discovery of EuFeAs2, currently the only charge-neutral parent phase of the 112-type iron-pnictide system, provides a new platform for the study of elemental doping effects on magnetism and superconductivity (SC). In this study, a series of polycrystalline EuFe1-yCoyAs2 and Eu0.9Pr0.1Fe1-yCoyAs2 samples are synthesized through solid-state reaction, and the evolutions of SC and magnetism with Co doping in EuFeAs2 and Eu0.9Pr0.1FeAs2 are investigated by electrical transport and magnetic susceptibility measurements. For EuFe1-yCoyAs2, the Eu-related antiferromagnetic (AFM) transition around 40 K is barely affected by Co doping, while the Fe-related spin density wave (SDW) transition temperature drops rapidly. Meanwhile, SC is induced by a trace amount of Co doping, with a highest transition temperature Tc ~ 28 K found in EuFe0.9Co0.1As2. For the Eu0.9Pr0.1Fe1-yCoyAs2 series, the magnetism and superconductivity show similar evolutions upon Co doping, and the highest Tc is enhanced to 30.6 K with an optimum doping level y ~ 0.07. Our results shed light on the competition between SC and SDW with Co doping in the 112-type EuFeAs2 system.