How to use bole - 10 common examples

To help you get started, we’ve selected a few bole 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 ceejbot / jthoober / bin / jthoober.js View on Github external
.help('help')
	.argv
;

const logger = bole('wrapper');
const outputs = [];
if (/^dev/.test(process.env.NODE_ENV))
{
	const prettystream = require('bistre')({ time: true });

	prettystream.pipe(process.stdout);
	outputs.push({ level: 'debug', stream: prettystream });
}
else
	outputs.push({ level: 'info', stream: process.stdout });
bole.output(outputs);

// resolve ./ to the current working directory executing jthoober.
const rulesModule = argv.rules.match(/^.\//) ? path.resolve(process.cwd(), argv.rules) : argv.rules;
const ruleInput = require(rulesModule);
const rules = [];
ruleInput.forEach(data =>
{
	const r = new jthoober.Rule(data);
	rules.push(r);
	logger.info(`loaded ${r.name}`);
});

const opts = {
	name: 'jthoober',
	port: process.env.PORT || argv.port,
	host: process.env.HOST || argv.host,
github ceejbot / opsbot / lib / logging.js View on Github external
outputs.push({ level: 'info', stream: fs.createWriteStream(fname) });
	}

	if (opts.logging.console)
	{
		if (process.env.NODE_ENV === 'dev')
		{
			var prettystream = require('bistre')({time: true}); // pretty
			prettystream.pipe(process.stdout);
			outputs.push({ level: 'debug', stream: prettystream });
		}
		else
			outputs.push({level: 'info', stream: process.stdout });
	}

	bole.output(outputs);
};
github ceejbot / opsbot / bin / opsbot.js View on Github external
}

var cf = path.resolve(process.cwd(), process.argv[2]);
var config = require(cf);

var outputs = [];
if (process.env.NODE_ENV === 'dev')
{
	var prettystream = require('bistre')({ time: true }); // pretty
	prettystream.pipe(process.stdout);
	outputs.push({ level: 'debug', stream: prettystream });
}
else
	outputs.push({level: 'info', stream: process.stdout });

bole.output(outputs);

var opsbot = new Opsbot(config);
opsbot.start();
github npm-wharf / hikaru / src / commands / deploy.js View on Github external
}

  config.saveDiffs = argv.saveDiffs

  const options = {
    version: config.version
  }

  if (argv.tokenFile) {
    options.data = inquire.loadTokens(argv.tokenFile)
  }
  if (config.scale) {
    options.scale = config.scale
  }

  bole.output({
    level: argv.verbose ? 'debug' : 'info',
    stream: debugOut
  })

  config.version = await version.getVersion(config)
  await hikaru.deployCluster(argv.source, options)
    .catch(async err => {
      if (!err.tokens) {
        console.error(`There was a problem in the specification at '${argv.source}'.\n ${err.stack}`)
        process.exit(100)
      }
      console.log(`${err.tokens.length} tokens were found in the specification. When prompted, please provide a value for each.`)
      const tokens = await inquire.acquireTokens(err.tokens)
      if (options.data !== undefined) {
        options.data = Object.assign(options.data, tokens)
      } else {
github npm-wharf / hikaru / src / commands / run.js View on Github external
if (argv.tokenFile) {
    options.data = inquire.loadTokens(argv.tokenFile)
  }
  if (config.scale) {
    options.scale = config.scale
  }
  if (!argv.job || !/[.]/.test(argv.job)) {
    console.log(`the job name is required and must include the namespace and job name in 'namespace.job' format`)
    process.exit(-1)
  }

  const [ namespace, jobName ] = argv.job.split('.')
  options.namespace = namespace
  options.job = jobName

  bole.output({
    level: argv.verbose ? 'debug' : 'info',
    stream: debugOut
  })

  config.version = await version.getVersion(config)
  await hikaru.runJob(argv.source, options)
    .catch(async err => {
      if (!err.tokens) {
        console.error(`There was a problem in the specification at '${argv.source}'.\n ${err.stack}`)
        process.exit(100)
      }
      console.log(`${err.tokens.length} tokens were found in the specification. When prompted, please provide a value for each.`)
      const tokens = await inquire.acquireTokens(err.tokens)
      if (options.data !== undefined) {
        options.data = Object.assign(options.data, tokens)
      } else {
github npm-wharf / hikaru / src / commands / remove.js View on Github external
const cached = aliasCache.getAlias(argv.alias)
    Object.assign(config, cached)
  }

  const options = {
    version: config.version
  }

  if (argv.tokenFile) {
    options.data = inquire.loadTokens(argv.tokenFile)
  }
  if (config.scale) {
    options.scale = config.scale
  }

  bole.output({
    level: argv.verbose ? 'debug' : 'info',
    stream: debugOut
  })

  config.version = await version.getVersion(config)
  await hikaru.removeCluster(argv.source, options)
    .catch(async err => {
      if (!err.tokens) {
        console.error(`There was a problem in the specification at '${argv.source}'.\n ${err.stack}`)
        process.exit(100)
      }
      console.log(`${err.tokens.length} tokens were found in the specification. When prompted, please provide a value for each.`)
      const tokens = await inquire.acquireTokens(err.tokens)
      return hikaru.removeCluster(err.specPath, Object.assign(
        {},
        options,
github npm-wharf / hikaru / src / commands / alias.js View on Github external
config.username = argv.user
  }
  if (argv.password) {
    config.password = argv.password
  }
  if (argv.token) {
    config.token = argv.token
  }
  if (argv.url) {
    config.url = argv.url
  }
  if (argv.apiVersion) {
    config.version = argv.apiVersion
  }

  bole.output({
    level: 'info',
    stream: debugOut
  })

  config.version = await version.getVersion(config)
  hikaru.aliasCluster(aliasCache, config)
    .then(
      () => console.log(`Alias '${config.alias}' for '${config.url}' was written to '${aliasCache.cacheFile}' successfully.`),
      () => {
        console.error(`There was a problem connecting to '${config.url}' with the information provided, alias was not created.`)
        process.exit(100)
      }
    )
}
github pinojs / pino / benchmarks / child-creation.bench.js View on Github external
const bole = require('bole')('bench')
const fs = require('fs')
const plog = pino(pino.destination(('/dev/null')))
delete require.cache[require.resolve('../')]
const plogExtreme = require('../')(pino.extreme('/dev/null'))

const max = 10
const blog = bunyan.createLogger({
  name: 'myapp',
  streams: [{
    level: 'trace',
    stream: fs.createWriteStream('/dev/null')
  }]
})

require('bole').output({
  level: 'info',
  stream: fs.createWriteStream('/dev/null')
}).setFastTime(true)

const run = bench([
  function benchBunyanCreation (cb) {
    var child = blog.child({ a: 'property' })
    for (var i = 0; i < max; i++) {
      child.info({ hello: 'world' })
    }
    setImmediate(cb)
  },
  function benchBoleCreation (cb) {
    var child = bole('child')
    for (var i = 0; i < max; i++) {
      child.info({ hello: 'world' })
github pinojs / pino / benchmarks / deep-object.bench.js View on Github external
const plogUnsafeExtreme = require('../')({safe: false}, pino.extreme('/dev/null'))

const loglevel = require('./utils/wrap-log-level')(dest)

const deep = Object.assign({}, require('../package.json'), { level: 'info' })

const max = 10
const blog = bunyan.createLogger({
  name: 'myapp',
  streams: [{
    level: 'trace',
    stream: dest
  }]
})

require('bole').output({
  level: 'info',
  stream: dest
}).setFastTime(true)

const chill = winston.createLogger({
  transports: [
    new winston.transports.Stream({
      stream: fs.createWriteStream('/dev/null')
    })
  ]
})

const run = bench([
  function benchBunyanDeepObj (cb) {
    for (var i = 0; i < max; i++) {
      blog.info(deep)
github pinojs / pino / benchmarks / object.bench.js View on Github external
const loglevel = require('./utils/wrap-log-level')(dest)
const plog = pino(dest)
delete require.cache[require.resolve('../')]
const plogExtreme = require('../')(pino.extreme('/dev/null'))
delete require.cache[require.resolve('../')]
const plogUnsafe = require('../')({safe: false}, dest)
delete require.cache[require.resolve('../')]
const plogUnsafeExtreme = require('../')({safe: false}, pino.extreme('/dev/null'))
const blog = bunyan.createLogger({
  name: 'myapp',
  streams: [{
    level: 'trace',
    stream: dest
  }]
})
require('bole').output({
  level: 'info',
  stream: dest
}).setFastTime(true)
const chill = winston.createLogger({
  transports: [
    new winston.transports.Stream({
      stream: fs.createWriteStream('/dev/null')
    })
  ]
})

const max = 10

const run = bench([
  function benchBunyanObj (cb) {
    for (var i = 0; i < max; i++) {

bole

A tiny JSON logger

MIT
Latest version published 14 days ago

Package Health Score

77 / 100
Full package analysis

Popular bole functions