本文整理汇总了TypeScript中winston.debug函数的典型用法代码示例。如果您正苦于以下问题:TypeScript debug函数的具体用法?TypeScript debug怎么用?TypeScript debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor() {
winston.debug("jupyter BlobStore: constructor");
try {
this._init();
winston.debug(`jupyter BlobStore: ${JUPYTER_BLOBS_DB_FILE} opened fine`);
} catch (err) {
winston.debug(
`jupyter BlobStore: ${JUPYTER_BLOBS_DB_FILE} open error - ${err}`
);
// File may be corrupt/broken/etc. -- in this case, remove and try again.
// This database is only an image *cache*, so this is fine.
// See https://github.com/sagemathinc/cocalc/issues/2766
// Using sync is also fine, since this only happens once
// during initialization.
winston.debug("jupyter BlobStore: resetting database cache");
try {
fs.unlinkSync(JUPYTER_BLOBS_DB_FILE);
} catch (error) {
err = error;
winston.debug(
`Error trying to delete ${JUPYTER_BLOBS_DB_FILE}... ignoring: `,
err
);
}
this._init();
}
}
开发者ID:DrXyzzy,项目名称:smc,代码行数:27,代码来源:jupyter-blobs-sqlite.ts
示例2: pollSwitch
function pollSwitch(){
var status = switchGPIO.read();
winston.debug('status: ', status)
noisebridge.isOn(status == true);
if (noisebridge.inUse()) {
winston.debug('Current Session ID: ' + noisebridge.currentSession.id);
} else {
winston.debug('No Current Session');
}
setTimeout(pollSwitch, 1000);
}
开发者ID:rfilmyer,项目名称:game-of-thrones,代码行数:11,代码来源:test.ts
示例3: spawnMore
function spawnMore() {
var worker;
if (options.worker) {
worker = child.fork(options.worker, options.workerArgs);
log.debug("Spawning worker %s as child process: %j %j",
pid(worker), options.worker, options.workerArgs);
} else {
worker = cluster.fork();
log.debug("Spawning worker in cluster:", pid(worker));
}
startTimes[pid(worker)] = Date.now();
if (!options.worker) {
worker.on("listening", (addr) =>
log.info("Process", pid(worker), "is now listening on",
addr.address + ":" + addr.port));
}
// Enable Erlang mode
worker.on("exit", (code, signal) => {
var replacement, lifetime = Date.now() - startTimes[pid(worker)];
delete startTimes[pid(worker)];
if (worker.suicide) {
log.info("Worker", pid(worker), "terminated voluntarily.");
return;
}
log.info("Process", pid(worker), "terminated with signal", signal,
"code", code + "; restarting.");
if (lifetime < options.failureThreshold) {
failures++;
} else {
failures = 0;
}
if (failures > options.retryThreshold) {
log.warn(failures + " consecutive failures; pausing for",
options.retryDelay + "ms before respawning.");
}
setTimeout(() => {
replacement = spawnMore();
replacement.on("online", () =>
log.info("Process", replacement.process.pid,
"has successfully replaced", pid(worker)));
}, (failures > options.retryThreshold) ? options.retryDelay : 0);
});
return worker;
}
开发者ID:FutureAdLabs,项目名称:hellojoe,代码行数:52,代码来源:hellojoe.ts
示例4:
const findCoverFile = (dirname: string): string => {
const preferredFilenames = [
'cover.jpg',
'cover.jpeg',
'folder.jpg',
'folder.jpeg',
'front.jpg',
'front.jpeg'
];
const filepaths = glob.sync('**/*.{jpeg,jpg}', { cwd: dirname });
let found;
for (const filepath of filepaths) {
const base = path.basename(filepath).toLowerCase();
if (preferredFilenames.indexOf(path.basename(base)) > -1) {
found = filepath;
}
if (found) {
continue;
}
found = filepath;
}
if (found) {
const resolved = path.resolve(dirname, found);
log.debug('Found cover art file: %s', resolved);
return resolved;
}
return '';
};
开发者ID:mshick,项目名称:arrivals-osx,代码行数:35,代码来源:convertAudio.ts
示例5: enqueueFile
public async enqueueFile(
filepath: string,
filetype: FileJobType
): Promise<boolean> {
try {
const tag = new Tag(filepath);
const jobType = filetype;
const jobStatus = FileJobStatus.Pending;
const filePayload: FilePayload = {
jobStatus,
jobType
};
await this.files.put(filepath, filePayload);
const fileJobPayload: FileJobPayload = {
filepath,
jobType
};
const jobId = await this.queue.pushPromise(fileJobPayload);
logger.debug('File enqueued with jobId: %s', jobId);
await tag.addTag('Yellow');
return true;
} catch (err) {
logger.error('Error in enqueue\n%s', prettyPrint(err));
return false;
}
}
开发者ID:mshick,项目名称:arrivals-osx,代码行数:34,代码来源:dispatcher.ts
示例6: it
it("Toggles verbosity", function(done) {
LoggingHelper.initialize(true);
let logger = function (log: string) {
assert(log.indexOf("Verbosity1") === -1);
assert(log.indexOf("Verbosity3") === -1);
if (log.indexOf("Verbosity2") !== -1) {
LoggingHelper.setVerbose(false);
winston.log("verbose", "Verbosity3");
winston.info("Verbosity4");
}
if (log.indexOf("Verbosity4") !== -1) {
done();
}
};
// Stub stderr and stdout - seems winston sends to both
// Though seemingly debug goes to stderr and info goes to stdout!
sandbox.stub(process.stderr, "write", logger);
sandbox.stub(process.stdout, "write", logger);
winston.debug("Verbosity1", function () {
LoggingHelper.setVerbose(true);
winston.log("verbose", "Verbosity2");
});
});
开发者ID:debmalya,项目名称:bst,代码行数:27,代码来源:logging-helper-test.ts
示例7: handleFileEvent
private async handleFileEvent(filePath: string): Promise<boolean> {
const stat = await lstat(filePath);
return stat.isFile() &&
this.isValidFileType(filePath) &&
(await this.dispatcher.isNewFile(filePath))
? this.handleFile(filePath) && true
: logger.debug('Skipping file: %s', filePath) && false;
}
开发者ID:mshick,项目名称:arrivals-osx,代码行数:8,代码来源:fileWatcher.ts
示例8: resolve
return new Promise<string | undefined>((resolve, reject) => {
const imgTypeExt = imgType === 'gold' ? 'gif' : imgType === 'art' ? 'jpg' : 'png'
const filename = `/data/images/${imgType === 'image' ? '' : imgType}/${this.id}.${imgTypeExt}`
if (fs.existsSync(filename)) {
winston.debug(`${filename} found, using that.`)
return resolve(filename)
}
const imgUrl = imgType === 'art' ?
`${baseArtUrl}/${this.id}.jpg` :
imgType === 'gold' ?
`${baseGoldUrl}/${this.id}_premium.gif` :
`${baseImageUrl}/${this.id}.png`
winston.debug(`Creating file at ${filename}`)
let requestClosedClean: boolean = false
const writeStream: fs.WriteStream = fs.createWriteStream(filename)
.on('error', (err: Error) => {
winston.error(`Error in file creation: ${err}`)
fs.unlink(filename, resolve.bind(undefined, undefined))
})
.on('finish', () => {
if (requestClosedClean) {
winston.debug('Created file successfully.')
resolve(filename)
} else {
fs.unlink(filename, resolve.bind(undefined, undefined))
}
})
winston.debug(`Downloading from ${imgUrl}`)
request.get(imgUrl, { timeout: 5000 })
.on('error', (err: Error) => {
winston.error(`Error downloading: ${err.message || 'unknown'}`)
fs.unlink(filename, resolve.bind(undefined, undefined))
})
.on('response', (response: IncomingMessage) => {
if (response.statusCode !== 200) {
winston.error(`Error downloading: ${response.statusCode} - ${response.statusMessage}`)
} else {
requestClosedClean = true
}
})
.pipe(writeStream)
.on('close', () => requestClosedClean = true)
})
开发者ID:tinnvec,项目名称:stonebot,代码行数:46,代码来源:card.ts
示例9: handleFile
private async handleFile(filePath: string): Promise<boolean> {
logger.info('Taking file: %s', filePath);
const jobType = this.getJobType(filePath);
logger.debug('Took %s %s', filePath, jobType);
// Give directories a chance to write cover files
// await sleep(1000);
return this.dispatcher.enqueueFile(filePath, jobType);
}
开发者ID:mshick,项目名称:arrivals-osx,代码行数:10,代码来源:fileWatcher.ts
注:本文中的winston.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论