當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript util.debuglog函數代碼示例

本文整理匯總了TypeScript中util.debuglog函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript debuglog函數的具體用法?TypeScript debuglog怎麽用?TypeScript debuglog使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了debuglog函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: debuglog

  GoAwayFrame,
  ConnectionCloseFrame,
  WindowUpdateFrame,
  StopWaitingFrame,
  BlockedFrame,
} from './internal/frame'
import { Packet, ResetPacket, RegularPacket } from './internal/packet'
import { QuicError, StreamError } from './internal/error'
import { ConnectionFlowController } from './internal/flowcontrol'
import { RTTStats } from './internal/congestion'

import { Socket, sendPacket } from './socket'
import { Stream } from './stream'
import { BufferVisitor, toBuffer, Queue } from './internal/common'

const debug = debuglog('quic:session')

//
// *************** Session ***************
//
export class Session extends EventEmitter {
  // Event: 'timeout'
  // Event: 'close'
  // Event: 'error'
  // Event: 'stream'
  // Event: 'version'
  // Event: 'goaway'

  protected [kID]: ConnectionID
  protected [kType]: SessionType
  protected [kIntervalCheck]: NodeJS.Timer | null
開發者ID:toajs,項目名稱:quic,代碼行數:31,代碼來源:session.ts

示例2: find

#!/usr/bin/env node

import bluebird from 'bluebird';
import fs from 'fs';
import jubatus from 'jubatus';
import _ from 'lodash';
import minimist from 'minimist';
import path from 'path';
import util from 'util';

const debug = util.debuglog('jubatus-tutorial-node');
const { common: { types: { Datum } }, classifier: { types: { LabeledDatum }, client: { Classifier } } } = jubatus;

const args = minimist(process.argv.slice(2), { default: { p: 9199, h: 'localhost', n: '', t: 0, c: 10 } });
debug('%o', args);

const { p: port, h: host, n: name, t: timeout, c: concurrency } = args;
const classifier = new Classifier(port, host, name, timeout);

const readFile = bluebird.promisify(fs.readFile);
const readDir = bluebird.promisify(fs.readdir);
const find = (dirname: string) => readDir(dirname).then(files => files.map(file => path.join(dirname, file)));
const mapStat = (file: string, iteratee: (stat: fs.Stats, file: string) => string | any) =>
    new Promise<string>((resolve, reject) => fs.stat(file, (error, stat) => error ? reject(error) : resolve(iteratee(stat, file))));
const filterStat = (files: string[], predicate: (stat: fs.Stats) => boolean) =>
    // tslint:disable-next-line:no-shadowed-variable
    Promise.all(files.map(file => mapStat(file, stat => predicate(stat) && file))).then(files => files.filter(file => file));
const list = (dirname: string) => {
    return find(dirname)
        .then(files => filterStat(files, stat => stat.isDirectory()))
        .then(directories => Promise.all(directories.map(directory => find(directory))))
開發者ID:naokikimura,項目名稱:jubatus-tutorial-node,代碼行數:31,代碼來源:tutorial.ts

示例3: require

const chalk = require('chalk');
const util = require('util');
const debuglog = util.debuglog('ghost');
const {GHOST_DEBUG} = process.env;

// { emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }

// black
// red
// green
// yellow
// blue
// magenta
// cyan
// white
// gray

interface Logger {
	info(message, ...vars)
	debug(message, ...vars)
	error(message, ...vars)
}

function isoDate() {
	return (new Date(Date.now())).toISOString();
}

function noop() {
}

export function hex(buffer) {
開發者ID:w3gh,項目名稱:ghost.js,代碼行數:31,代碼來源:Logger.ts

示例4: debuglog

  kVersion,
  kServer,
  kIntervalCheck,
} from './internal/symbol'
import {
  FamilyType,
  SocketAddress,
  SessionType,
  ConnectionID,
  isSupportedVersion,
} from './internal/protocol'

import { createSocket, Socket, AddressInfo } from './socket'
import { Session } from './session'

const debug = debuglog('quic')

export class ServerSession extends Session {
  [kServer]: Server
  constructor (id: ConnectionID, socket: Socket, server: Server) {
    super(id, SessionType.SERVER)
    this[kSocket] = socket
    this[kServer] = server
    this[kState].localPort = server.localPort
    this[kState].localAddress = server.localAddress
    this[kState].localFamily = server.localFamily
    this[kState].localAddr = new SocketAddress(server.address())
    this[kState].maxPacketSize =
      server.localFamily === FamilyType.IPv6 ? MaxPacketSizeIPv6 : MaxPacketSizeIPv4
  }
開發者ID:toajs,項目名稱:quic,代碼行數:30,代碼來源:server.ts

示例5: debuglog

  StreamID,
} from './internal/protocol'
import { StreamFrame, RstStreamFrame, BlockedFrame } from './internal/frame'
import { StreamFlowController } from './internal/flowcontrol'
import { BufferVisitor } from './internal/common'
import {
  kID,
  kFC,
  kSession,
  kState,
  kRTT,
} from './internal/symbol'

import { Session } from './session'

const debug = debuglog('quic:stream')

export class Stream extends Duplex {
  // Event: 'close'
  // Event: 'connect'
  // Event: 'data'
  // Event: 'drain'
  // Event: 'end'
  // Event: 'error'
  // Event: 'timeout'
  // Event: 'aborted'
  // Event: 'finish'
  // Event: 'frameError'

  private [kID]: StreamID
  private [kSession]: Session
開發者ID:toajs,項目名稱:quic,代碼行數:31,代碼來源:stream.ts


注:本文中的util.debuglog函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。