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


TypeScript Logger.info方法代碼示例

本文整理匯總了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}`)
     }
   })
 }
開發者ID:TechNottingham,項目名稱:Hack24-API,代碼行數:11,代碼來源:eventbroadcaster.ts

示例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);
    });
開發者ID:akreitals,項目名稱:pino-aws-logger,代碼行數:18,代碼來源:logger.spec.ts

示例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 }
}
開發者ID:TechNottingham,項目名稱:Hack24-API,代碼行數:40,代碼來源:attendee-auth-strategy.ts

示例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 }
}
開發者ID:TechNottingham,項目名稱:Hack24-API,代碼行數:14,代碼來源:attendee-auth-strategy.ts


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