How to use draftlog - 10 common examples

To help you get started, we’ve selected a few draftlog 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 ddsol / speedtest.net / index.js View on Github external
function visualSpeedTest(options, callback) {
  require('draftlog').into(console);

  // We only need chalk and DraftLog here. Lazy load it.
  var chalk = require('chalk')
    , test = speedTest(options)
    , log  = function() {}
    , finalData
    , percentage = 0
    , speed = 0
    , bar = console.draft()
    , size = 50
    , red = (chalk.supportsColor ? chalk.bgRed(' ') : '─')
    , green = (chalk.supportsColor ? chalk.bgGreen(' ') : '▇')
    ;

  callback = once(callback);
github Fndroid / clash_speedtest / speedtest / index.js View on Github external
function visualSpeedTest(options, callback) {
  require('draftlog').into(console);

  // We only need chalk and DraftLog here. Lazy load it.
  var chalk = require('chalk')
    , test = speedTest(options)
    , log  = function() {}
    , finalData
    , percentage = 0
    , speed = 0
    , bar = console.draft()
    , size = 50
    , red = (chalk.supportsColor ? chalk.bgRed(' ') : '─')
    , green = (chalk.supportsColor ? chalk.bgGreen(' ') : '▇')
    ;

  callback = once(callback);
github Fndroid / clash_speedtest / index.js View on Github external
const speedTest = require('speedtest-net');
// const speedTest = require('./speedtest/index')
require('draftlog').into(console)
const axios = require('axios')
const node_xlsx = require('node-xlsx')
const fs = require('fs')
const path = require('path')
const moment = require('moment')

const EC = "127.0.0.1:9090" // 外部控制器 External Controller
const TIME = 10 // 测试时间,单位秒
const PROXY = "http://127.0.0.1:7890" // Clash的http代理

let xlsx = node_xlsx.default

let startTesting = async (id) => {
  return new Promise((resolve, reject) => {
    var test = speedTest({ maxTime: TIME * 1000, serverId: id, proxy: PROXY });
github handsontable / hot-builder / src / reporters / console.js View on Github external
'use strict';

var eventEmitter = require('event-emitter');
var cancelledMarkVisitor = require('./tokenVisitors/cancelledMark');
var customVisitor = require('./tokenVisitors/custom');
var doneMarkVisitor = require('./tokenVisitors/doneMark');
var paddingVisitor = require('./tokenVisitors/padding');
var spinnerVisitor = require('./tokenVisitors/spinner');
var logger = require('./../helpers/logger');

require('draftlog').into(console);

/**
 * @param {String} message Message pattern to print.
 */
function Console(message, customTokens) {
  this.quiet = logger().transports.caporal.level === 'warn';
  this.message = message;
  this.compiledMessage = message;
  /* eslint-disable no-console */
  this.draft = this.quiet ? null : console.draft();
  this.timer = null;
  this.stopped = false;
  this.customTokens = customTokens || {};
  this.visitors = [
    customVisitor(this.customTokens),
    cancelledMarkVisitor(),
github alibaba / funcraft / lib / docker.js View on Github external
const docker = new Docker();
const dockerOpts = require('./docker-opts');
const definition = require('./definition');
const getVisitor = require('./visitor').getVisitor;
const getProfile = require('./profile').getProfile;

const { blue, red, yellow } = require('colors');
const { parseArgsStringToArgv } = require('string-argv');
const { extractNasMappingsFromNasYml } = require('./nas/support');
const { addEnv, addInstallTargetEnv, resolveLibPathsFromLdConf } = require('./install/env');
const { findPathsOutofSharedPaths } = require('./docker-support');
const { processorTransformFactory } = require('./error-processor');

const _ = require('lodash');

require('draftlog').into(console);

var containers = new Set();

const devnull = require('dev-null');

// exit container, when use ctrl + c
function waitingForContainerStopped() {
  // see https://stackoverflow.com/questions/10021373/what-is-the-windows-equivalent-of-process-onsigint-in-node-js
  const isRaw = process.isRaw;
  const kpCallBack = (_char, key) => {
    if (key & key.ctrl && key.name === 'c') {
      process.emit('SIGINT');
    }
  };
  if (process.platform === 'win32') {
    if (process.stdin.isTTY) {
github TendaDigital / Turin-Bot / serial.js View on Github external
const chalk = require('chalk')
const SerialPort = require('serialport')
const SerialCommandProtocol = require('./SerialCommandProtocol')
const ReconnectableSerialPort = require('./ReconnectableSerialPort')
const sleep = ms => new Promise((res, rej) => setTimeout(res, ms))

require('draftlog').into(console)

// SerialPort.list(console.log)

let arduinoPort = new ReconnectableSerialPort({ serialNumber: 'AH03B7U8' })
let arduino = new SerialCommandProtocol(arduinoPort)

let robotPort = new ReconnectableSerialPort({
  comName: '/dev/tty.JOAO_S2_IVAN-DevB'
}, {
  baudRate: 115200,
})


let meudraft = console.draft('Ola, tudo bem?')

let colors = [
github deptagency / octopus / lib / app.js View on Github external
'[href^="file:"]',
    '[href^="news:"]',
    '[href^="tel:"]',
    '[href^="ftp:"]',
    '[href^="#"]'
];

/**
 * Output line length
 */
const maxLength = windowWidth - 20;

/**
 * Console streaming
 */
require('draftlog').into(console);
console.stream = console.draft(EOL);


/**
 * Magic function for the brokenLinks object
 */
const brokenLinksObserver = new Proxy(brokenLinks, {
    set: function(target, key, value) {

        // Extract variables
        const {requestUrl, referenceUrl, statusMessage, statusCode} = value;

        // Push to object
        target.push(requestUrl);

        // Terminal output
github naholyr / cli-fuzzy-search / lib / main.js View on Github external
'use strict'

const chalk = require('chalk')
const userInput = require('./input')
const fuzzy = require('./fuzzy')
const debounce = require('lodash.debounce')

require('draftlog').into(console)


// stdin: tty.ReadStream, data: () => Promise([{ …, label }]), size: number, debug: boolean => Promise({ …, label, highlight, index })
module.exports = ({
	stdin = process.stdin,
	size = 10,
	data,
	search,
	fuzzyOnSearch = false,
	debounceDelay = 300,
	cache = true,
	debug = false,
}) => new Promise((resolve, reject) => {

	if (!data && !search) {
		return reject(Error('Required option "data" or "search"'))
github TendaDigital / playstore-cli / index.js View on Github external
const _ = require('lodash')
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const axios = require('axios')
const puppeteer = require('puppeteer')

const draftlog = require('draftlog').into(console)
// const LogSession = require('draftlog-session')

const Pupt = require('./helpers/pupt')
const sleep = require('./helpers/sleep')
const Parsers = require('./helpers/parsers')
const GetXsrf = require('./helpers/get-xsrf')
const mapLimit = require('./helpers/mapLimit')
const executor = require('./helpers/puptExecutor')


module.exports = class PlayApi {
  constructor(config) {
    if (!config) throw new Error('config must be an object');
    if (!config.email) throw new Error(`Missing 'email' parameter`)
    if (!config.password) throw new Error(`Missing 'password' parameter`)
    if (!config.browser) throw new Error(`Missing 'browser' parameter with puppeteer instance`);
github TendaDigital / Turin-Bot / VM.js View on Github external
const _ = require('lodash')
const chalk = require('chalk')
const Lexer = require('./Lexer')

require('draftlog').into(console)

module.exports = class VM {
  constructor(cursorDelegate, robotDelegate) {
    this.cursor = cursorDelegate
    this.robot = robotDelegate

    // Debug mode
    this.debug = true

    // last command
    this.lastCommand = 0

    // keep position of saved bookmark
    this.bookmarks = {}

    // initialize all registers with 0

draftlog

Create updatable log lines into the terminal, and give life to your logs!

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis

Popular draftlog functions