This paper deals with the problem of cooperative attitude tracking with time-varying communication delays as well as the delays between inter-synchronization control parts and self-tracking control parts in the spacecraft formation flying. First, we present the attitude synchronization tracking control algorithms and analyze the sufficient delay-dependent stability condition with the choice of a Lyapunov function when the angular velocity can be measured. More specifically, a class of linear filters is developed to derive an output feedback control law without having direct information of the angular velocity, which is significant for practical applications with low-cost configurations of spacecraft. Using a well-chosen Lyapunov-Krasovskii function, it is proven that the presented control law can make the spacecraft formation attitude tracking system synchronous and achieve exponential stability, in the face of model uncertainties, as well as non-uniform time-varying delays in communication links and different control parts. Finally, simulation results are presented to demonstrate the effectiveness of the proposed control schemes.