How to use the debug.colors function in debug

To help you get started, we’ve selected a few debug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleChrome / lighthouse / lighthouse-logger / index.js View on Github external
const isWindows = process.platform === 'win32';

// process.browser is set when browserify'd via the `process` npm module
const isBrowser = process.browser;

const colors = {
  red: isBrowser ? 'crimson' : 1,
  yellow: isBrowser ? 'gold' : 3,
  cyan: isBrowser ? 'darkturquoise' : 6,
  green: isBrowser ? 'forestgreen' : 2,
  blue: isBrowser ? 'steelblue' : 4,
  magenta: isBrowser ? 'palevioletred' : 5,
};

// whitelist non-red/yellow colors for debug()
debug.colors = [colors.cyan, colors.green, colors.blue, colors.magenta];

class Emitter extends EventEmitter {
  /**
   * Fires off all status updates. Listen with
   * `require('lib/log').events.addListener('status', callback)`
   * @param {string} title
   * @param {!Array<*>} argsArray
   */
  issueStatus(title, argsArray) {
    if (title === 'status' || title === 'statusEnd') {
      this.emit(title, [title, ...argsArray]);
    }
  }

  /**
   * Fires off all warnings. Listen with
github roadiz / roadiz / themes / Rozier / Resources / webpack / build / environments.js View on Github external
import webpack from 'webpack'
import cssnano from 'cssnano'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import postcssFixes from 'postcss-fixes'
import postcssReduceTransform from 'postcss-reduce-transforms'
import cssMqpacker from 'css-mqpacker'
import Harddisk from 'html-webpack-harddisk-plugin'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import debug from 'debug'
import OptimizeCSSPlugin from 'optimize-css-assets-webpack-plugin'

const dbg = debug('Roadiz-front:webpack-config:environments  ')
dbg.color = debug.colors[5]

export default {
    development: (base, config) => ({
        watch: true,
        devServer: {
            stats: config.stats,
            port: config.port,
            publicPath: config.public_path,
            host: config.address,
            watchOptions: {
                // poll: config.watchInterval,
                aggregateTimeout: 50,
                ignored: [/node_modules/, '/bower_components/' ,'/Resources\/app\/vendor/']
            }
        },
        resolve: {
github rezozero / starting-blocks / build / config / base.js View on Github external
import debug from 'debug'
import path from 'path'
import startingBlocks from '../../src/bundle'

const dbg = debug('StartingBlocks:config:base  ')
dbg.color = debug.colors[2]

const getConfig = () => {
    let config = {
        env: process.env.NODE_ENV || 'development'
    }

    config = {
        ...config,
        devtool: false,

        // ----------------------------------
        // Project Structure
        // ----------------------------------
        path_base: path.resolve(__dirname, '..', '..'),
        dir_entry: 'src',
        dir_dist: '',
github roadiz / roadiz / themes / Rozier / Resources / webpack / build / base.js View on Github external
import webpack from 'webpack'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import debug from 'debug'
import WebpackNotifierPlugin from 'webpack-notifier'
import path from 'path'
import CleanWebpackPlugin from 'clean-webpack-plugin'
import BundleAnalyzer from 'webpack-bundle-analyzer'

const BundleAnalyzerPlugin = BundleAnalyzer.BundleAnalyzerPlugin
const dbg = debug('Roadiz-front:webpack-config:base  ')
dbg.color = debug.colors[3]

function resolve (dir) {
    return path.join(__dirname, '..', '..', dir)
}

const createLintingRule = (config) => ({
    test: /\.(js|vue)$/,
    loader: 'eslint-loader',
    enforce: 'pre',
    include: [resolve('app'), resolve('test')],
    exclude: [/node_modules/, /bower_components/, /Resources\/app\/vendor/],
    options: {
        formatter: require('eslint-friendly-formatter'),
        emitWarning: !config.showEslintErrorsInOverlay
    }
})
github rezozero / starting-blocks / examples / webpack / build / environments.js View on Github external
import webpack from 'webpack'
import debug from 'debug'

const dbg = debug('StartingBlocks:webpack-config:environments  ')
dbg.color = debug.colors[5]

const optimization = {
    splitChunks: {
        chunks: 'all',
        cacheGroups: {
            commons: {
                name: 'commons',
                chunks: 'all',
                minChunks: 2,
                minSize: 0,
                enforce: true
            }
        }
    }
}
github rezozero / starting-blocks / build / build / base.js View on Github external
import webpack from 'webpack'
import debug from 'debug'
import WebpackNotifierPlugin from 'webpack-notifier'

const dbg = debug('StartingBlocks:webpack-config:base  ')
dbg.color = debug.colors[3]

const getWebpackConfigBase = (config) => {
    const paths = config.utils_paths

    dbg('⚙  Exporting default webpack configuration.')

    let webpackConfig = {
        cache: true,
        stats: config.stats,
        devtool: config.devtool,
        target: 'web',
        context: paths.dist(),
        module: {
            rules: [{
                test: /\.js$/,
                enforce: 'pre',
github xiaodoudou / PlexIPTV / logger.js View on Github external
selectColor (namespace) {
    let hash = 0
    let i
    for (i in namespace) {
      hash = ((hash << 5) - hash) + namespace.charCodeAt(i)
      hash |= 0
    }
    return createDebug.colors[Math.abs(hash) % createDebug.colors.length]
  }
github rezozero / starting-blocks / examples / webpack / config / index.js View on Github external
import debug from 'debug'
import path from 'path'
import getConfigBase from './base'
import configOverrides from './environments'

const dbg = debug('StartingBlocks:config  ')
dbg.color = debug.colors[1]

const getConfig = () => {
    dbg('👷‍♂️  Creating configuration.')

    let configBase = getConfigBase()

    dbg(`🕵️‍♂️  Looking for environment overrides for NODE_ENV "${configBase.env}".`)

    const overrides = configOverrides[configBase.env]

    if (configOverrides[configBase.env]) {
        dbg('🙋‍♂️  Found overrides, applying to default configuration.')
        Object.assign(configBase, overrides(configBase))
    } else {
        dbg('🤷‍♂️  No environment overrides found.')
    }
github rezozero / starting-blocks / examples / webpack / build / index.js View on Github external
import debug from 'debug'
import getWebpackConfigBase from './base'
import webpackConfigOverrides from './environments'
import WebpackMerge from 'webpack-merge'

const dbg = debug('StartingBlocks:webpack-config  ')
dbg.color = debug.colors[4]

const getWebpackConfig = (config) => {
    dbg('👷‍♂️  Creating webpack configuration')

    const base = getWebpackConfigBase(config)
    const baseModern = WebpackMerge.smart(base, webpackConfigOverrides['modern'](base, config))
    const baseLegacy = WebpackMerge.smart(base, webpackConfigOverrides['legacy'](base, config))

    dbg(`🕵️‍♂️  Looking for environment overrides for NODE_ENV "${config.env}".`)

    const overrides = webpackConfigOverrides[config.env]

    if (webpackConfigOverrides[config.env]) {
        dbg('🙋‍♂️  Found overrides, applying to default configuration.')

        return [