How to use the cf-nodejs-logging-support.forceLogger 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-restify.js View on Github external
var messages = [];
var pub = redis.createClient();
var sub = redis.createClient();

// setup redis publisher and subscriber
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);

// force logger to run restify version. (default is express, forcing express is also legal)
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);
github SAP / cf-nodejs-logging-support / sample / cf-nodejs-shoutboard / web-restify.js View on Github external
var messages = [];
var pub = redis.createClient();
var sub = redis.createClient();

// setup redis publisher and subscriber
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);

// 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 }));