本文整理汇总了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
示例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))))
示例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) {
示例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
}
示例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