cf-nodejs-logging-support
Advanced tools
Comparing version 6.5.4 to 6.6.0
33
index.js
//loading core logger functionality | ||
var coreLogger = require("./cf-nodejs-logging-support-core/log-core"); | ||
var coreLogger = require("./core/log-core"); | ||
var effectiveLogger = null; | ||
@@ -7,4 +7,4 @@ | ||
effectiveLogger = require("./cf-nodejs-logging-support-express/log-express"); | ||
defaultConfig = require("./config.js"); | ||
effectiveLogger = require("./logger/log-express"); | ||
defaultConfig = require("./config"); | ||
effectiveLogger.setCoreLogger(coreLogger); | ||
@@ -36,9 +36,9 @@ | ||
case "restify": | ||
effectiveLogger = require("./cf-nodejs-logging-support-restify/log-restify"); | ||
effectiveLogger = require("./logger/log-restify"); | ||
break; | ||
case "plainhttp": | ||
effectiveLogger = require("./cf-nodejs-logging-support-plainhttp/log-plainhttp"); | ||
effectiveLogger = require("./logger/log-plainhttp"); | ||
break; | ||
default: | ||
effectiveLogger = require("./cf-nodejs-logging-support-express/log-express"); | ||
effectiveLogger = require("./logger/log-express"); | ||
} | ||
@@ -48,3 +48,22 @@ effectiveLogger.setCoreLogger(coreLogger); | ||
exports.enableTracing = function (input) { | ||
names = []; | ||
if (typeof input == "string") | ||
names.push(input); | ||
else | ||
names = input; | ||
var config = defaultConfig.config; | ||
for(var i in names) { | ||
switch (names[i].toLowerCase()) { | ||
case "sap_passport": | ||
config.push(...require("./trace/sap_passport").config); | ||
break; | ||
default: | ||
} | ||
} | ||
coreLogger.setConfig(config); | ||
return config; | ||
} | ||
exports.logNetwork = function (req, res, next) { | ||
@@ -72,3 +91,3 @@ effectiveLogger.logNetwork(req, res, next); | ||
options.logMessage = coreLogger.logMessage; | ||
return require("./cf-nodejs-logging-support-winston/winston-transport").createTransport(options); | ||
return require("./winston/winston-transport").createTransport(options); | ||
}; | ||
@@ -75,0 +94,0 @@ |
{ | ||
"name": "cf-nodejs-logging-support", | ||
"version": "6.5.4", | ||
"version": "6.6.0", | ||
"description": "Logging tool for Cloud Foundry", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -235,2 +235,12 @@ # Node.js Logging Support for Cloud Foundry | ||
You can also use this feature from the global logging context like so: | ||
```js | ||
log = require("cf-nodejs-logging-support"); | ||
var subLogger = log.createLogger(); | ||
subLogger.setCustomFields({"field-a" :"value"}) | ||
// OR | ||
var subLogger = log.createLogger({"field-a" :"value"}); | ||
``` | ||
### Check log severity levels | ||
@@ -448,2 +458,15 @@ In some cases it can be useful to check if messages with a specific severity level would be logged. You can check if a logging level is active as follows: | ||
## Tracing | ||
### SAP_passport | ||
example: | ||
``` | ||
2a54482a0300e60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a54482a | ||
``` | ||
SAP Passport is an end to end tracing technology used in many SAP products. | ||
It is a binary format encoded in hex notation. | ||
Applications can add the whole SAP Passport in this field or give its constituents in the respective fields. | ||
to read up on the possible fields, please look at [fields](https://github.com/SAP/cf-java-logging-support/blob/master/cf-java-logging-support-core/beats/app-logs/docs/fields.asciidoc). | ||
### Custom sink function | ||
@@ -450,0 +473,0 @@ Per default the library writes output messages to `stdout`. For debugging purposes it can be useful to redirect the output of the library to another sink (e.g. `console.log()`). You can set a custom sink method as follows: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119634
18
1760
509
1