本文整理汇总了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)
}
};
示例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)
}
}
示例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)
}
}
示例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)
}
}
示例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)
}
}