Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fh-fhc

Package Overview
Dependencies
Maintainers
2
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fh-fhc - npm Package Compare versions

Comparing version 0.7.18-172 to 0.7.19-174

68

lib/logs.js

@@ -6,6 +6,10 @@ module.exports = logs;

logs.usage = "\nfhc logs [get] <app-id> [log-name] [--live]"
//+ "\nfhc logs stream <app-id> [log-name] [output-file] [--live]"
+ "\nfhc logs tail <app-id> [last-N-lines] | [offset-from] [log-name] [--live]"
+ "\nfhc logs list <app-id> [--live]"
+ "\nfhc logs delete <app-id> <log-name> [--live]";
+ "\n"
+ "\n Note: log tail defaults to the current std-out log file & display last 1000 lines of log file"
+ "\n To specify an offset, pass -1 for the last-N-lines param - e.g. "
+ "\n log tail -1 12345"
+ "\n This will return all log entries from position 12345 onwards"
var log = require("./utils/log");

@@ -42,11 +46,12 @@ var fhc = require("./fhc");

return getLogs(appId, logName, target, cb);
}/*else if (action === "stream") {
//if (!args[3]) return cb(logs.usage);
var appId = fhc.appId(args[1]);
var logName = args[2];
var outputFile = args[3];
return streamLog(appId, logName, outputFile, target, cb);
}*/ else if (action === "list") {
} else if (action === "tail") {
if (!args[1]) return cb(logs.usage);
var appId = fhc.appId(args[1]);
var last = args[2];
var offset = args[3];
var logName = args[4];
return tailLog(process.stdout, appId, last, offset, logName, target, cb);
} else if (action === "list") {
if (!args[1]) return cb(logs.usage);
var appId = fhc.appId(args[1]);
return listLogs(appId, target, cb);

@@ -195,2 +200,47 @@ }else if (action === "delete") {

function logChunk(appName, last, offset, logName, cb) {
var payload = {
"last":last,
"offfset":offset
};
common.doApiCall(fhreq.getFeedHenryUrl(), "box/srv/1.1/ide/" + fhc.target + "/app/logchunk", payload, "", function(err, data) {
return cb(err, data);
});
};
function tailLog(stream, appName, last, offset, logName, target, cb) {
var payload = {
"guid": appName,
"action": "chunk",
"deploytarget": target
};
if( last ) payload.last = last;
if( offset ) payload.offset = offset;
if( logName ) payload.logname = logName;
common.doApiCall(fhreq.getFeedHenryUrl(), "box/srv/1.1/ide/" + fhc.target + "/app/logchunk", payload, "", function(err, res) {
if(err) return cb(err);
var lastOffset = res.msg ? res.msg.offset : undefined;
if( "undefined" == typeof(lastOffset)) {
return cb("offset undefined");
}
if( res.msg.data.length > 0 ) {
stream.write(res.msg.data.join("\n") + "\n");
}
// Check for new logs every 1 second
setTimeout(function() {
tailLog(stream, appName, undefined, lastOffset, logName, target, function(err, res) {
if (err) cb(err);
});
}, 1000);
});
};
// bash completion

@@ -197,0 +247,0 @@ logs.completion = function (opts, cb) {

58

lib/utils/request.js

@@ -24,3 +24,3 @@ module.exports = request;

function doRequest (fhurl, method, where, what, etag, nofollow, cb_) {
log.silly(where||"/", method);
log.silly(where||"/", method);

@@ -64,3 +64,3 @@ if (where.match(/^\/?favicon.ico/)) {

log.silly(port, "port");
var headers = getHeaders();

@@ -93,8 +93,8 @@

var opts = { uri : where
, method: method
, body: what
, headers: headers
, proxy: getProxy(remote)
, followRedirect : !nofollow
};
, method: method
, body: what
, headers: headers
, proxy: getProxy(remote)
, followRedirect : !nofollow
};

@@ -139,3 +139,3 @@ var startTime = Date.now();

var er = undefined;
if (parsed && parsed.error) {

@@ -160,4 +160,4 @@ var w = url.parse(where).pathname.substr(1)

, caches = p.map(function (part) {
return _ = path.join(_, part);
}).map(function (cache) {
return _ = path.join(_, part);
}).map(function (cache) {
return path.join(fhc.cache, cache, ".cache.json");

@@ -189,3 +189,3 @@ });

function doGetUrl(url, callback) {
request.requestFunc(url, "GET", where, null, null, function(er, parsed, data, response) {
request.requestFunc(url, "GET", where, null, null, function(er, parsed, data, response) {
callback(er, data);

@@ -212,3 +212,3 @@ });

}
post_data.push(new Buffer(EncodeFilePart(boundary, contentType, 'file', filename), 'ascii'));

@@ -230,6 +230,6 @@

function EncodeFieldPart(boundary,name,value) {
var return_part = "--" + boundary + "\r\n";
return_part += "Content-Disposition: form-data; name=\"" + name + "\"\r\n\r\n";
return_part += value + "\r\n";
return return_part;
var return_part = "--" + boundary + "\r\n";
return_part += "Content-Disposition: form-data; name=\"" + name + "\"\r\n\r\n";
return_part += value + "\r\n";
return return_part;
}

@@ -239,6 +239,6 @@

function EncodeFilePart(boundary,type,name,filename) {
var return_part = "--" + boundary + "\r\n";
return_part += "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + filename + "\"\r\n";
return_part += "Content-Type: " + type + "\r\n\r\n";
return return_part;
var return_part = "--" + boundary + "\r\n";
return_part += "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + filename + "\"\r\n";
return_part += "Content-Type: " + type + "\r\n\r\n";
return return_part;
}

@@ -262,5 +262,5 @@

headers : {
'Content-Type' : 'multipart/form-data; boundary=' + boundary,
'Content-Length' : length,
'Cookie' : "feedhenry=" + fhc.config.get("cookie") + ";"
'Content-Type' : 'multipart/form-data; boundary=' + boundary,
'Content-Length' : length,
'Cookie' : "feedhenry=" + fhc.config.get("cookie") + ";"
}

@@ -279,3 +279,3 @@ };

data = JSON.parse(data);
return cb(undefined, data);
return cb(undefined, data);
});

@@ -306,5 +306,5 @@ response.on('error', function(err) {

var opts = {
url : fullUrl
, headers : headers
, proxy : getProxy(remote)
url : fullUrl
, headers : headers
, proxy : getProxy(remote)
};

@@ -409,3 +409,3 @@

if (r.substr(-1) !== "/") r += "/";
fhc.config.set("messaging", r);
fhc.config.set("messaging", r);
return r;

@@ -412,0 +412,0 @@ }

@@ -5,3 +5,3 @@ {

"keywords" : [ "cli", "feedhenry" ],
"version": "0.7.18-172",
"version": "0.7.19-174",
"preferGlobal" : true,

@@ -8,0 +8,0 @@ "homepage" : "http://git.io/fh-fhc",

@@ -1,1 +0,1 @@

0.7.18-172
0.7.19-174

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc