当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript pino.Logger类代码示例

本文整理汇总了TypeScript中pino.Logger的典型用法代码示例。如果您正苦于以下问题:TypeScript Logger类的具体用法?TypeScript Logger怎么用?TypeScript Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Logger类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 log at log level info when LOG_LEVEL is not set', async () => {
    const restore: () => void = setupEnv('LOG_LEVEL', '');

    logger = await createLogger();

    try {
      logger.debug({ someObject: { someNesting: true } }, 'some message');
      logger.info({ someObject: { someNesting: true } }, 'some message');
      expect(stdoutSpy).toHaveBeenCalledTimes(1);
    } finally {
      restore();
    }
  });
开发者ID:akreitals,项目名称:pino-aws-logger,代码行数:13,代码来源:logger.spec.ts

示例3: getBaseLogger

export const createLogger = (
  options: PinoAwsLoggerOptions = {}
): Promise<Logger> => {
  const { decorators = [], ...pinoOptions } = options;
  const logger: Logger = getBaseLogger(pinoOptions);

  return getMetadata([...decorators, ...defaultDecorators])
    .then(metadata => {
      const definedMetadata = filterUndefinedValues(metadata);
      return logger.child(definedMetadata);
    })
    .catch(() => {
      return logger;
    });
};
开发者ID:akreitals,项目名称:pino-aws-logger,代码行数:15,代码来源:logger.ts

示例4: constructor

 constructor(url: string, private log: Logger) {
   if (!url) {
     this.log.warn('Pusher URL is not defined. Suppressing Pusher events.')
     return
   }
   this._pusher = Pusher.forURL(url)
 }
开发者ID:TechNottingham,项目名称:Hack24-API,代码行数:7,代码来源:eventbroadcaster.ts

示例5: setTimeout

      }, (err) => {
        err.message = `Unable to connect to MongoDB - ${err.message}`

        if (attempts < MAX_RECONNECT_ATTEMPTS) {
          log.warn(err.message)
          setTimeout(connect, RECONNECT_DELAY)
          return
        }

        reject(err)
      })
开发者ID:TechNottingham,项目名称:Hack24-API,代码行数:11,代码来源:database.ts


注:本文中的pino.Logger类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。