How to use the consola.withTag function in consola

To help you get started, we’ve selected a few consola 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 bakjs / bak / packages / mongo / lib / utils.js View on Github external
const consola = require('consola').withTag('MongoDB')

// Utiliy function to setup logger on db
function logConnectionEvents (conn) {
  // Emitted after getting disconnected from the db.
  // _readyState: 0
  conn.on('disconnected', () => {
    conn.$logger.debug('Disconnected!')
  })

  // Emitted when this connection successfully connects to the db.
  // May be emitted multiple times in reconnected scenarios.
  // _readyState: 1
  conn.on('connected', () => {
    conn.$logger.success('Connected!')
  })
github nuxt-community / google-adsense-module / lib / module.js View on Github external
const { resolve } = require('path')
const consola = require('consola')
const logger = consola.withTag('nuxt-adsense-module')
// Default for adslots (defaults to test mode)
const DEFAULTS = {
  tag: 'adsbygoogle',
  id: null,
  pageLevelAds: false,
  includeQuery: false,
  analyticsUacct: '',
  analyticsDomainName: '',
  test: false,
  shouldRandomizeAdRegion: false
}

// Default client ID for testing
const TEST_ID = 'ca-google'

// Adsense script URL
github Developmint / nuxt-bundle-buddy / lib / module.js View on Github external
import consola from 'consola'
import BundleBuddyWebpackPlugin from 'bundle-buddy-webpack-plugin'

const logger = consola.withTag('nuxt-bundle-buddy')

export default function nuxtBundleBuddy() {
  const { build: { analyze }, dev, bundleBuddy } = this.options

  const options = Object.assign({}, { removeDefaultAnalyzer: true }, bundleBuddy)

  if (!dev && analyze) {
    logger.info('Loading module')
    this.extendBuild(webpackFn(options))
  }
}

const webpackFn = options => (config, { isServer, isModern }) => {
  // Only evaluate client bundle
  if (isServer || isModern) {
    return
github nuxt / nuxt.js / scripts / package.js View on Github external
_init () {
    // Try to read package.json
    this.readPkg()

    // Use tagged logger
    this.logger = consola.withTag(this.pkg.name)

    // Try to load config
    this.loadConfig()
  }
github jsless / ipx / packages / ipx / src / utils.js View on Github external
if (!argRegex.test(arg)) {
    throw badRequest('Invalid argument: ' + arg)
  }
  return arg
}

export const VMax = max => num => {
  if (!numRegex.test(num)) {
    throw badRequest('Invalid numeric argument: ' + num)
  }
  return Math.min(parseInt(num), max) || null
}

export const VSize = VMax(MAX_SIZE)

export const consola = Consola.withTag('ipx')