How to use the cf-nodejs-logging-support.logNetwork function in cf-nodejs-logging-support

To help you get started, we’ve selected a few cf-nodejs-logging-support examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SAP / cf-nodejs-logging-support / sample / cf-nodejs-shoutboard / web-express.js View on Github external
pub.on("end", redisEndHandler);
sub.on("end", redisEndHandler);
pub.on("error", redisErrorHandler);
sub.on("error", redisErrorHandler);

// set the logging level threshold
log.setLoggingLevel("info");

// register names of custom fields
log.registerCustomFields(["node_version", "pid", "platform"])

// parse body json params
app.use(express.json());       

// add logger to the server network queue to log all incoming requests.
app.use(log.logNetwork);

// host static files
app.use("/", express.static(__dirname + "/public"));

// set port and run server
var port = Number(process.env.VCAP_APP_PORT || 8080);
app.listen(port, function () {
    log.info("listening on port: %d", port);
});

// log some custom fields
var stats = {
    node_version: process.version,
    pid: process.pid,
    platform: process.platform,
};
github SAP / cf-nodejs-logging-support / sample / cf-nodejs-shoutboard / web-restify.js View on Github external
sub.on("error", redisErrorHandler);

// force logger to run restify version. (default is express, forcing express is also legal)
log.forceLogger("restify");

// set the minimum logging level
log.setLoggingLevel("info");

// setup serving of static files
app.get("/*", restify.plugins.serveStatic({
    directory: "./public",
    default: "index.html"
}));

// insert the logger as middleware to log each request.
app.use(log.logNetwork);

// parse body json params
app.use(restify.plugins.bodyParser({ mapParams: true }));

// setup CF port
var port = Number(process.env.VCAP_APP_PORT || 8080);
app.listen(port, function () {
    //write a message using the logMessage method of the logger.
    log.logMessage("info", "listening on port: %d", port);
});


// create a json object and send it as custom log with the given logger.
var stats = {};
stats.node_version = process.version;
log.logMessage("info", "Runtime statistics", stats);
github SAP / cf-nodejs-logging-support / sample / cf-nodejs-shoutboard / web-restify.js View on Github external
log.forceLogger("restify");

// set the logging level threshold
log.setLoggingLevel("info");

// register names of custom fields
log.registerCustomFields(["node_version", "pid", "platform"])

// setup serving of static files
app.get("/*", restify.plugins.serveStatic({
    directory: "./public",
    default: "index.html"
}));

// insert the logger as middleware to log each request.
app.use(log.logNetwork);

// parse body json params
app.use(restify.plugins.bodyParser({ mapParams: true }));

// set port and run server
var port = Number(process.env.VCAP_APP_PORT || 8080);
app.listen(port, function () {
    log.info("listening on port: %d", port);
});

// log some custom fields
var stats = {
    node_version: process.version,
    pid: process.pid,
    platform: process.platform,
};
github SAP / cf-nodejs-logging-support / sample / cf-nodejs-shoutboard / web-express.js View on Github external
sub.subscribe("message", "sync");
pub.on("connect", redisConnectionHandler);
sub.on("connect", redisConnectionHandler);
pub.on("end", redisEndHandler);
sub.on("end", redisEndHandler);
pub.on("error", redisErrorHandler);
sub.on("error", redisErrorHandler);

// set the minimum logging level
log.setLoggingLevel("info");

// parse body json params
app.use(express.json());       

// inserts the logger in the server network queue, so each time a https request is recieved, it is will get logged.
app.use(log.logNetwork);

app.use("/", express.static(__dirname + "/public"));

// setup CF port
var port = Number(process.env.VCAP_APP_PORT || 8080);
app.listen(port, function () {
    //write a message using the logMessage method of the logger.
    log.logMessage("info", "listening on port: %d", port);
});

// create a json object and send it as custom log with the given logger.
var stats = {};
stats.node_version = process.version;
log.logMessage("info", "Runtime statistics", stats);

// handling post messages