CityBEM-CityLayers-SaeedRay.../node_modules/roarr/dist/factories/createNodeWriter.js.flow

23 lines
520 B
Plaintext

// @flow
import type {
WriterType,
} from '../types';
const createBlockingWriter = (stream: stream$Writable): WriterType => {
return {
write: (message: string) => {
stream.write(message + '\n');
},
};
};
export default (): WriterType => {
// eslint-disable-next-line no-process-env
const targetStream = (process.env.ROARR_STREAM || 'STDOUT').toUpperCase();
const stream = targetStream.toUpperCase() === 'STDOUT' ? process.stdout : process.stderr;
return createBlockingWriter(stream);
};