当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript npmlog.info函数代码示例

本文整理汇总了TypeScript中npmlog.info函数的典型用法代码示例。如果您正苦于以下问题:TypeScript info函数的具体用法?TypeScript info怎么用?TypeScript info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了info函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 socket.on('connect', () => {
   log.info('Connected to ' + this.getConnectionInfo());
   socket.emit(
     'room',
     '/' + this.coin.toUpperCase() + '/' + this.v8network + '/inv'
   );
 });
开发者ID:bitpay,项目名称:bitcore,代码行数:7,代码来源:v8.ts

示例2:

    const returnError = (err, res, req) => {
      if (err instanceof ClientError) {
        const status = err.code == 'NOT_AUTHORIZED' ? 401 : 400;
        if (!opts.disableLogs)
          log.info(
            'Client Err: ' + status + ' ' + req.url + ' ' + JSON.stringify(err)
          );

        res
          .status(status)
          .json({
            code: err.code,
            message: err.message
          })
          .end();
      } else {
        let code = 500,
          message;
        if (err && ((err.code && _.isNumber(err.code)) || (err.statusCode && _.isNumber(err.statusCode)))) {
          code = err.code || err.statusCode;
          message = err.message || err.body;
        }

        const m = message || err.toString();

        if (!opts.disableLogs) log.error(req.url + ' :' + code + ':' + m);

        res
          .status(code || 500)
          .json({
            error: m
          })
          .end();
      }
    };
开发者ID:matiu,项目名称:bitcore,代码行数:35,代码来源:expressapp.ts

示例3: cb

 (err, db) => {
   if (err) {
     log.error('Unable to connect to the mongoDB', err);
     return cb(err, null);
   }
   log.info('Connection established to ' + uri);
   this.db = db;
   this._getStats((err, stats) => {
     if (err) return cb(err);
     return cb(null, stats);
   });
 }
开发者ID:bitpay,项目名称:bitcore,代码行数:12,代码来源:stats.ts

示例4: test

test('request', (t) => {
  t.plan(1);
  npmlog.level = 'silly';
  npmlog.silly('silly prefix', 'x = %j', {foo:{bar:'baz'}});
  npmlog.verbose('verbose prefix', 'x = %j', {foo:{bar:'baz'}});
  npmlog.info('info prefix', 'x = %j', {foo:{bar:'baz'}});
  npmlog.http('http prefix', 'x = %j', {foo:{bar:'baz'}});
  npmlog.warn('warn prefix', 'x = %j', {foo:{bar:'baz'}});
  npmlog.error('error prefix', 'x = %j', {foo:{bar:'baz'}});
  npmlog.silent('silent prefix', 'x = %j', {foo:{bar:'baz'}});

  t.deepEqual(result.join('').trim(), resultExpect.join('').trim(), 'result');
});
开发者ID:demurgos,项目名称:typed-npmlog,代码行数:13,代码来源:test.ts

示例5:

  expressApp.start(config, (err) => {
    if (err) {
      log.error('Could not start BWS instance', err);
      return;
    }

    server.listen(port);

    const instanceInfo = cluster.worker
      ? ' [Instance:' + cluster.worker.id + ']'
      : '';
    log.info('BWS running ' + instanceInfo);
    return;
  });
开发者ID:bitpay,项目名称:bitcore,代码行数:14,代码来源:bws.ts

示例6: icb

          .then(ret => {
            try {
              ret = JSON.parse(ret);

              // only process right responses.
              if (!_.isUndefined(ret.blocks) && ret.blocks != x) {
                log.info(`Ignoring response for ${x}:` + JSON.stringify(ret));
                return icb();
              }

              result[x] = ret.feerate;
            } catch (e) {
              log.warn('fee error:', e);
            }

            return icb();
          })
开发者ID:bitpay,项目名称:bitcore,代码行数:17,代码来源:v8.ts

示例7: initSocket

  initSocket(callbacks) {
    log.info('V8 connecting socket at:' + this.host);
    // sockets always use the first server on the pull
    const socket = io.connect(
      this.host,
      { transports: ['websocket'] }
    );

    socket.on('connect', () => {
      log.info('Connected to ' + this.getConnectionInfo());
      socket.emit(
        'room',
        '/' + this.coin.toUpperCase() + '/' + this.v8network + '/inv'
      );
    });

    socket.on('connect_error', () => {
      log.error('Error connecting to ' + this.getConnectionInfo());
    });
    socket.on('tx', callbacks.onTx);
    socket.on('block', (data) => {
      return callbacks.onBlock(data.hash);
    });
    socket.on('coin', data => {
      // script output, or similar.
      if (!data.address) return;
      let out;
      try {
        // TODO
        out = {
          address: data.address,
          amount: data.value / 1e8
        };
      } catch (e) {
        // non parsable address
        return;
      }
      return callbacks.onIncomingPayments({ outs: [out], txid: data.mintTxid });
    });

    return socket;
  }
开发者ID:bitpay,项目名称:bitcore,代码行数:42,代码来源:v8.ts

示例8:

  client.on('ready', () => {
    log.info('play', 'connected');

    client.exec(monogataris.tasks[0].shell, (err, stream) => {
      if(err) {
        throw err;
      }

      stream.on('close', (code, signal) => {
        log.info('play', `end code:${code}, signal:${signal}`);
        client.end();
      })
      .on('data', data => {
        log.info('play', data);
      })
      .stderr.on('data', data => {
        log.error('play', data);
      });

    });
  })
开发者ID:waffle-iron,项目名称:shikibu,代码行数:21,代码来源:play.ts

示例9: constructor

  constructor(opts) {
    super();

    opts = opts || {};
    if (opts.messageBrokerServer) {
      const url = opts.messageBrokerServer.url;

      this.remote = true;
      this.mq = require('socket.io-client').connect(url);
      this.mq.on('connect', () => { });
      this.mq.on('connect_error', () => {
        log.warn('Error connecting to message broker server @ ' + url);
      });

      this.mq.on('msg', (data) => {
        this.emit('msg', data);
      });

      log.info('Using message broker server at ' + url);
    }
  }
开发者ID:bitpay,项目名称:bitcore,代码行数:21,代码来源:messagebroker.ts

示例10: start

  /**
   * start
   *
   * @param opts.WalletService options for WalletService class
   * @param opts.basePath
   * @param opts.disableLogs
   * @param opts.doNotCheckV8
   * @param {Callback} cb
   */
  start(opts, cb) {
    opts = opts || {};

    this.app.use(compression());

    this.app.use((req, res, next) => {
      res.setHeader('Access-Control-Allow-Origin', '*');
      res.setHeader(
        'Access-Control-Allow-Methods',
        'GET, POST, OPTIONS, PUT, DELETE'
      );
      res.setHeader(
        'Access-Control-Allow-Headers',
        'x-signature,x-identity,x-session,x-client-version,x-wallet-id,X-Requested-With,Content-Type,Authorization'
      );
      res.setHeader('x-service-version', WalletService.getServiceVersion());
      next();
    });
    const allowCORS = (req, res, next) => {
      if ('OPTIONS' == req.method) {
        res.sendStatus(200);
        res.end();
        return;
      }
      next();
    };
    this.app.use(allowCORS);
    this.app.enable('trust proxy');

    // handle `abort` https://nodejs.org/api/http.html#http_event_abort
    this.app.use((req, res, next) => {
      req.on('abort', () => {
        log.warn('Request aborted by the client');
      });
      next();
    });

    const POST_LIMIT = 1024 * 100 /* Max POST 100 kb */;

    this.app.use(
      bodyParser.json({
        limit: POST_LIMIT
      })
    );

    if (opts.disableLogs) {
      log.level = 'silent';
    } else {
      const morgan = require('morgan');
      morgan.token('walletId', function getId(req) {
        return req.walletId ? '<' + req.walletId + '>' : '<>';
      });

      const logFormat =
        ':walletId :remote-addr :date[iso] ":method :url" :status :res[content-length] :response-time ":user-agent"  ';
      const logOpts = {
        skip(req, res) {
          if (res.statusCode != 200) return false;
          return req.path.indexOf('/notifications/') >= 0;
        }
      };
      this.app.use(morgan(logFormat, logOpts));
    }

    const router = express.Router();

    const returnError = (err, res, req) => {
      if (err instanceof ClientError) {
        const status = err.code == 'NOT_AUTHORIZED' ? 401 : 400;
        if (!opts.disableLogs)
          log.info(
            'Client Err: ' + status + ' ' + req.url + ' ' + JSON.stringify(err)
          );

        res
          .status(status)
          .json({
            code: err.code,
            message: err.message
          })
          .end();
      } else {
        let code = 500,
          message;
        if (err && ((err.code && _.isNumber(err.code)) || (err.statusCode && _.isNumber(err.statusCode)))) {
          code = err.code || err.statusCode;
          message = err.message || err.body;
        }

        const m = message || err.toString();

//.........这里部分代码省略.........
开发者ID:matiu,项目名称:bitcore,代码行数:101,代码来源:expressapp.ts


注:本文中的npmlog.info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。