listen() { return new Promise((resolve, reject) => { this._server = this._app.listen(this._port, (err) => { if (err) { return reject(err); } winston.info('[TestServer] listen at port %d', this._port); resolve(); }); }); }
shutdown() { winston.debug('[Main] shutdown'); this._master.shutdown(); this._commander.shutdown(); return this._manager .stop() .then(() => winston.info('[Main] All instances are stopped.')); }
shutdown() { winston.info('[TestServer] shutdown'); this._server.close(); }
listen() { return new Promise((resolve, reject) => { // Start server this._server = this._httpServer.listen(this._config.commander.port, (err) => { if (err) { return reject( new Error(`[Commander] Cannot listen at port ${this._config.commander.port}:${err.toString()}`) ); } winston.info('[Commander] GUI is available at http://localhost:%d', this._config.commander.port); resolve(); }); }); }
//////////// function initConfig(configFilename) { if (!configFilename || configFilename.length <= 0) { return winston.error('[Template] Error: Config file not specified'); } fs.exists(configFilename, (exists) => { if (exists) { return winston.error('[Template] Error: Config file already exists'); } template.write(configFilename, (err) => { if (err) { return winston.error('[Template] Error: Cannot write template to', configFilename); } winston.info('[Template] Template written in', configFilename); }); }); }
listen() { return new Promise((resolve, reject) => { this._server.listen(this._config.port, (err) => { if (err) { return reject(new Error(`[Master] Cannot listen at port ${this._config.port} : ${err.toString()}`)); } winston.info('Proxy is listening at http://localhost:%d', this._config.port); return resolve(); }); }); }
winston.info('[Main] The selected providers are', providersName.join(', '));
function testProxy(proxyUrl, count) { if (!proxyUrl || proxyUrl.length <= 0) { return winston.error('[Test] Error: URL not specified'); } // Default: 10 / Max: 1000 count = Math.min(count || 10, 1000); const proxy = new TestProxy(proxyUrl); const promises = []; for (let i = 0; i < count; ++i) { promises.push(proxy.request()); } Promise .all(promises) .then(() => { winston.info('[Test] %d IPs found:', proxy.size); proxy.count.forEach( (value, key) => winston.info('[Test] %s (%d times)', key, value) ); }) .catch((err) => { winston.error('[Test] Error: Cannot get IP address:', err); }); }
function ovhConsumerKey(endpoint, appKey, appSecret) { if (!appKey || appKey.length <= 0 || !appSecret || appSecret.length <= 0) { return winston.error('[OVH] Error: appKey or appSecret not specified'); } const client = ovh({ endpoint, appKey, appSecret, }); client.request('POST', '/auth/credential', { 'accessRules': [ {'method': 'GET', 'path': '/cloud/*'}, {'method': 'POST', 'path': '/cloud/*'}, {'method': 'PUT', 'path': '/cloud/*'}, {'method': 'DELETE', 'path': '/cloud/*'}, ], }, (err, credential) => { if (err) { return winston.error('[OVH] Error: Cannot get consumerKey:', err); } winston.info('[OVH] Your consumerKey is:', credential.consumerKey); winston.info('[OVH] Please validate your token here:', credential.validationUrl); }); }
io.on('connection', function(socket) { winston.info('Someone has connected to the chat'); socket.emit('connected'); // Send only the last 10 messages chatMessagesToSend = chatMessages.slice(Math.max(chatMessages.length - 10, 0)); io.emit('oldChatMessages', chatMessagesToSend); // Send system messages io.emit('oldSystemMessages', systemMessages); });
lib.genTextAvatar("", emptyOutputFilePath, 200, function () { var buf = fs.readFileSync(emptyOutputFilePath); cache[emptyOutputFilePath] = buf winston.info(`make empty image file :( ${emptyOutputFilePath}`) })
/** * Convenience method for setting the drone's max rotation speed limitation * @param {integer} tilt The max rotation speed from (50°-360° for Airborne Cargo / 50° - 180° for Mambo) * @return {undefined} */ writeMaxRotationSpeed(rotationSpeed) { const buffer = this.createBuffer(COMMAND_KEY, [MD_CLASSES.SPEED_SETTINGS, MD_METHODS.MAX_ROTATION_SPEED, 0x00, rotationSpeed, 0x00]); this.write(COMMAND_KEY, buffer); this.emit('maxRotationSpeedChange', rotationSpeed); Logger.info(`Setting max rotation speed to ${rotationSpeed} °/s`); }
router.get('/unsubscribe/:id', (req, res, next) => { logger.info(`Canceling subscription for ${req.params.id}`); mongo.database .collection('subscriptions') .findOneAndDelete({ _id: new mongo.ObjectID(req.params.id) }) .then(() => res.json({ok: true, message: 'You have been unsubscribed.'})) .catch(() => next(new throwjs.BadRequest('Database error'))); });
converter.launchChrome() .then(() => { http.createServer(handler).listen(process.env.PORT) winston.info(`Listening Port ${process.env.PORT}`) })
const deleteFile = (filePath) => { fs.unlink(filePath, err => { if (err) { return logger.error(`error deleting temporary file ${filePath}`); } logger.info(`successfully deleted ${filePath}`); }); }