if (count > 10) { countLimited = 10; winston.warn('[ProviderDigitalOcean] createInstances: limit instances creation count to 10 (%d asked)', count);
table .findAll({ where: { name, claim_id: claimId }, attributes: ['transaction_hash_id'], }) .then(result => { if (result.length === 0) { throw new Error(`no record found for ${name}#${claimId}`); } else if (result.length !== 1) { logger.warn(`more than one record matches ${name}#${claimId} in db.Claim`); } return result[0].transaction_hash_id; })
/** * Finds a Noble Characteristic class for the given characteristic UUID * @param {String} uuid The characteristics UUID * @return {Characteristic} The Noble Characteristic corresponding to that UUID */ getCharacteristic(uuid) { if (!this.characteristics.length) { Logger.warn('BTLE Device must be connected before calling this method'); return false; } return this.characteristics.filter((c) => c.uuid.search(new RegExp(uuid)) !== -1)[0]; }
updateRequestWithUserFromRefreshToken(req, res, next) { const refreshToken = req.cookies.refreshToken; if (refreshToken) { try { const decoded = jwt.verify(refreshToken, config.REFRESH_TOKEN_SECRET); req.user = decoded.account; } catch (err) { logger.warn(err); } } next(); }
this.findAll({ where: { name, claimId }, }) .then(claimArray => { switch (claimArray.length) { case 0: return resolve(null); case 1: return resolve(prepareClaimData(claimArray[0].dataValues)); default: logger.warn(`more than one record matches ${name}#${claimId} in db.Claim`); return resolve(prepareClaimData(claimArray[0].dataValues)); } }) .catch(error => { reject(error); });
const handler = (request, response) => { switch (request.url) { case '/favicon.ico': response.writeHead(200, { 'Content-Type': 'image/x-icon' }) response.end() break case '/status': response.writeHead(200) response.end() break default: requestData(request) .then(uriFromData) .then(converter.uriToPdf) .then(pdf => { response.writeHead(200, { 'Content-Type': 'application/pdf', 'Content-Length': pdf.byteLength }) response.end(pdf) }) .catch(reason => { response.writeHead(400) response.end() winston.warn(reason) }) } }
function configureLogging() { logger.info('configuring winston logger...'); if (!config) { return logger.warn('No logger config found'); } if (!logLevel) { logger.warn('No logLevel found in config.'); } // configure the winston logger logger.configure({ transports: [ new logger.transports.Console({ level: logLevel || 'debug', timestamp: true, colorize: true, prettyPrint: true, handleExceptions: true, humanReadableUnhandledException: true, }), ], }); // test all the log levels logger.info('testing winston log levels...'); logger.warn('Testing: Log Level 1'); logger.info('Testing: Log Level 2'); logger.verbose('Testing: Log Level 3'); logger.debug('Testing: Log Level 4'); logger.silly('Testing: Log Level 5'); }
logger.warn('Request refferer exceeds 255 characters:', referrer); referrer = referrer.substring(0, 255);
/** * Writes a buffer to a BTLE peripheral characteristic * Most convince methods in this class point to this method * * @param {String} uuid the characteristic's UUID * @param {Buffer} buffer stream of binary data * @return {undefined} */ write(uuid, buffer) { if (!this.characteristics.length) { Logger.warn('You must have bluetooth enabled and be connected to a drone before executing a command.'); return; } // Sequence number can only be stored in one byte, so we must reset after 255 if (this.steps[uuid] >= 255) { this.steps[uuid] = 0; } this.getCharacteristic(uuid).write(buffer, true); }
this.findAll({ where: { name, claimId }, attributes: ['outpoint'], }) .then(result => { logger.debug('outpoint result'); switch (result.length) { case 0: throw new Error(`no record found for ${name}#${claimId}`); case 1: return result[0].dataValues.outpoint; default: logger.warn(`more than one record matches ${name}#${claimId} in db.Claim`); return result[0].dataValues.outpoint; } }) .catch(error => { throw error; })
table .findAll({ where: { name: claimName, claim_type: 1, publisher_id: channelId, }, }) .then(claimArray => { if (claimArray.length === 0) { return null; } else if (claimArray.length !== 1) { logger.warn(`more than one record matches ${claimName} in ${channelId}`); } return claimArray[0]; })
table .findAll({ where: { name: claimName, claim_type: 1, publisher_id: channelClaimId, bid_state: { [sequelize.Op.or]: ['Controlling', 'Active', 'Accepted'] }, }, order: [['id', 'ASC']], }) .then(result => { switch (result.length) { case 0: return null; case 1: return result[0].claim_id; default: // Does this actually happen??? (from converted code) logger.warn( `${result.length} records found for "${claimName}" in channel "${channelClaimId}"` ); return result[0].claim_id; } })
this.findAll({ where: { name: claimName, certificateId: channelClaimId }, order: [['id', 'ASC']], }) .then(result => { switch (result.length) { case 0: return reject(NO_CLAIM); case 1: return resolve(result[0].claimId); default: logger.warn( `${result.length} records found for "${claimName}" in channel "${channelClaimId}"` ); return resolve(result[0].claimId); } }) .catch(error => { reject(error); });
table .findAll({ where: { name, claim_id: claimId }, }) .then(claimArray => { if (claimArray.length === 0) { return null; } else if (claimArray.length !== 1) { logger.warn(`more than one record matches ${name}#${claimId} in db.Claim`); } return claimArray[0]; }) .catch(error => { logger.verbose(`resolveClaim failed: ${error}`) reject(error); })
table .findAll({ where: { claim_id: publisher_id }, attributes: ['name'], }) .then(result => { if (result.length === 0) { throw new Error(`no record found for ${claimId}`); } else if (result.length !== 1) { logger.warn(`more than one record matches ${claimId} in db.Claim`); } return result[0].name; })