environment detection for output function