src/index.js
function configuredFormatter(options = {}) {
    let { typeFormat } = options;
    if (typeFormat === undefined) {
        if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'dev') {
            typeFormat = 'console';
        } else {
            typeFormat = 'json';
        }
    }

    if (typeFormat === 'json') {
        return combine(
            timestamp(),
            addMetaFormat(options),
            jsonFormat
        );
    }
    if (typeFormat === 'console') {
        return combine(
            timestamp(),
            colorize(),
            consoleFormat
        );
    }
    throw new Error(`${typeFormat} is not json or console.`);
}
function configuredFormatter(options = {}) {
    let { typeFormat } = options;
    if (typeFormat === undefined) {
        if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'dev') {
            typeFormat = 'console';
        } else {
            typeFormat = 'json';
        }
    }

    if (typeFormat === 'json') {
        return combine(
            timestamp(),
            addMetaFormat(options),
            jsonFormat
        );
    }
    if (typeFormat === 'console') {
        return combine(
            timestamp(),
            colorize(),
            consoleFormat
        );
    }
    throw new Error(`${typeFormat} is not json or console.`);
}
function configuredFormatter ( options = { } ) { let { typeFormat } = options ; if ( typeFormat === undefined ) { if ( process . env . NODE_ENV === 'development' || process . env . NODE_ENV === 'dev' ) { typeFormat = 'console' ; } else { typeFormat = 'json' ; } } if ( typeFormat === 'json' ) { return combine ( timestamp ( ) , addMetaFormat ( options ) , jsonFormat ) ; } if ( typeFormat === 'console' ) { return combine ( timestamp ( ) , colorize ( ) , consoleFormat ) ; } throw new Error ( ` ${ typeFormat } ` ) ; }
Configured formatter to check for env and key words (console and json)
@param {Object} options
@return {string} format
Configured formatter to check for env and key words ( console and json )