本文整理匯總了TypeScript中pino.Logger.info方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Logger.info方法的具體用法?TypeScript Logger.info怎麽用?TypeScript Logger.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pino.Logger
的用法示例。
在下文中一共展示了Logger.info方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: trigger
public trigger(event: string, data: any, logger: Logger) {
if (!this._pusher) {
return logger.info(`Suppressing Pusher event "${event}" for channel "api_events"`, data)
}
logger.info(`Sending Pusher event "${event}" to channel "api_events"`)
this._pusher.trigger('api_events', event, data, null, (err) => {
if (err) {
logger.error(`Unable to send event to pusher: ${err.message}`)
}
})
}
示例2: it
it('should only check for enabled decorators once', async () => {
const testDecorator: LogDecorator = {
isEnabled: jest.fn(),
metadataKey: 'test-decorator',
getMetadata: jest.fn(),
};
const options: PinoAwsLoggerOptions = {
decorators: [testDecorator],
};
logger = await createLogger(options);
logger.info('1');
logger.info('2');
logger.info('3');
expect(testDecorator.isEnabled).toBeCalledTimes(1);
});
示例3: validateAttendeeBySlackId
async function validateAttendeeBySlackId(username: string, slack: WebClient, log: Logger) {
if (!slackIdPattern.test(username)) {
log.info(`Invalid slackid: "${username}"`)
return null
}
log.info(`Finding attendee with slackid "${username}"...`)
const attendee = await AttendeeModel
.findOne({ slackid: username }, '_id attendeeid')
.exec()
if (attendee !== null) {
log.info(`Found attendee "${username}" to be "${attendee.attendeeid}`)
return { username: attendee.attendeeid }
}
log.info(`Looking up Slack profile for attendee "${username}"...`)
let slackUser: UsersInfoResponse
try {
slackUser = await slack.users.info(username)
} catch (err) {
log.error(`Could not look-up user "${username}" on Slack API: ${err.message}`)
return null
}
log.info(`Found "${username}" to be "${slackUser.user.profile.email}"`)
const updateResponse = await AttendeeModel
.findOneAndUpdate({ attendeeid: slackUser.user.profile.email }, { slackid: slackUser.user.id })
.select('_id')
.exec()
if (updateResponse === null) {
return null
}
return { username: slackUser.user.profile.email }
}
示例4: validateAttendeeByEmailAddress
async function validateAttendeeByEmailAddress(username: string, log: Logger) {
log.info(`Finding attendee with email "${username}"...`)
const attendees = await AttendeeModel
.find({ attendeeid: username }, '_id')
.limit(1)
.exec()
if (attendees.length === 0) {
return null
}
return { username }
}