本文整理匯總了TypeScript中loge.logger.info方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript logger.info方法的具體用法?TypeScript logger.info怎麽用?TypeScript logger.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類loge.logger
的用法示例。
在下文中一共展示了logger.info方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: callback
.execute((error: Error, rows: {name: string, average: number}[]) => {
if (error) return callback(error)
logger.info('averaged downloads for %d packages', rows.length)
const packages: {[index: string]: number} = {}
rows.forEach(row => packages[row.name] = row.average)
callback(null, packages)
})
示例2: readExistingTweets
function readExistingTweets(outputFilepath: string,
callback: (error: Error, fetchedStatuses?: {[index: string]: number}) => void) {
let fetchedStatuses: {[index: string]: number} = {};
// quick exit if output is undefined
if (outputFilepath === undefined) return callback(null, fetchedStatuses);
logger.info(`Reading existing tweets from "${outputFilepath}"`);
let inputStream = createReadStream(outputFilepath, {flags: 'r', encoding: 'utf8'});
inputStream.pipe(new JSONParser())
.on('data', (status: Status) => {
fetchedStatuses[status.id_str] = 1;
})
.on('error', (error: Error) => {
callback(error);
})
.on('end', () => {
logger.info(`Found ${Object.keys(fetchedStatuses).length} tweets in "${outputFilepath}"`);
callback(null, fetchedStatuses);
});
}
示例3: callback
.on('end', () => {
logger.info(`Found ${Object.keys(fetchedStatuses).length} tweets in "${outputFilepath}"`);
callback(null, fetchedStatuses);
});
示例4:
server.on('listening', () => {
const address = server.address()
const addressString = typeof address == 'string' ? address : `${address.address}:${address.port}`
logger.info('server listening on http://%s', addressString)
})