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


TypeScript Logger.warning方法代码示例

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


在下文中一共展示了Logger.warning方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getAllOfRunNumber

/**
 * Functions for retrieving data from DB
 */

// get all items in the run number given a hash
// if following is true, get only future predictions from the timestamp
async function getAllOfRunNumber(hash, following) {
  // calculate a range of values. run numbers are per day,
  // so this gets us a list of all other predictions given the run number and a timestamp

  let unixTime = Number(hash.prdt) * 1000

  let min = new Date(unixTime)
  min.setHours(0, 0, 0)

  let max = new Date(unixTime) // have to set this again here to get us another object to operate on
  max.setHours(0, 0, 0)
  max.setDate(max.getDate() + 1)

  // only get the following predictions
  if (following) {
    min = new Date(unixTime)
  }

  var params = {
      TableName : 'cta-trains',
      KeyConditionExpression: 'rn = :rn and prdt BETWEEN :min AND :max',
      ExpressionAttributeValues: {
          ':min': min.getTime() / 1000,
          ':max': max.getTime() / 1000,
          ':rn': Number(hash.rn)
      }
  };

  try {
    let query = await dynamo.queryAsync(params)
    return query.Items
  } catch (error) {
    logger.warning(error)
  }
};
开发者ID:open-cta,项目名称:wss-api,代码行数:41,代码来源:app.ts

示例2: getTrainsByTimestamp

// essentially just run both of the two above functions together
async function getTrainsByTimestamp(timestamp) {
  try {
    let trainsHash = await trainHashAtTimestamp(timestamp);
    if (trainsHash.length > 0) {
      let trains = await getTrainByHash(trainsHash);
      return trains
    }
  } catch (error) {
    logger.warning(error)
  }
}
开发者ID:open-cta,项目名称:wss-api,代码行数:12,代码来源:app.ts

示例3: iterate

// start with a timestamp and just keep working into THE FUTURE
async function iterate(ws, timestamp) {
  try {
    for (var ts = timestamp; iterating; ts++) {
      let trains = await getTrainsByTimestamp(ts)
      if (typeof trains !== 'undefined') {
        ws.send(JSON.stringify(trains[0]))
      }
    }
  } catch (error) {
    logger.warning(error)
  }
}
开发者ID:open-cta,项目名称:wss-api,代码行数:13,代码来源:app.ts

示例4: trainHashAtTimestamp

// get a hash (patition/sort key) by searching the index
async function trainHashAtTimestamp(timestamp) {
  var params = {
      TableName : 'cta-trains',
      IndexName: 'prdt-index',
      KeyConditionExpression: 'prdt = :prdtime',
      ExpressionAttributeValues: {
          ':prdtime': timestamp
      }
  };

  try {
     let query = await dynamo.queryAsync(params)
     return query.Items
  } catch (error) {
    logger.warning(error)
  }
}
开发者ID:open-cta,项目名称:wss-api,代码行数:18,代码来源:app.ts

示例5: getTrainByHash

// Get a train prediction by it's hash (partition - rn number and sort key - prdt)
async function getTrainByHash(hash) {
  var params = {
      TableName : 'cta-trains',
      KeyConditionExpression: 'prdt = :prdt and rn = :rn',
      ExpressionAttributeValues: {
          ':prdt': hash[0].prdt, // need to handle cases of multiple trains
          ':rn': hash[0].rn
      }
  };

  try {
    let query = await dynamo.queryAsync(params)
    return query.Items
  } catch (error) {
    logger.warning(error)
  }
}
开发者ID:open-cta,项目名称:wss-api,代码行数:18,代码来源:app.ts


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