I have the safelight/s near the enlarger hooked to the timer so they go on and off as needed. With B&W, the safelight/s in the processing area, sink, etc. stay on. For color, they all turn off while the paper is out of the box and then white or normal light on after the paper is in the processing drum/tube.
My timer turns my safelight off whenever the enlarger is on. If you have a good safelight, there is no danger in leaving it on during enlarging, but if is often much easier to see the image if it is off. This is especially true if the light is bright. A while back I worked in a darkroom with a Thomas safelight. Perfectly safe, but extremely bright. Since it is a sodium arc lamp, it needed to remain on all the time. I had to adjust the shutters to exclude most of the light from the enlarger area in order to see the image at all.