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

cf-nodejs-logging-support

Package Overview
Dependencies
Maintainers
5
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-nodejs-logging-support - npm Package Compare versions

Comparing version 6.12.0 to 6.13.0

9

docs/advanced-usage/04-dynamic-logging-level-threshold.md

@@ -33,5 +33,12 @@ ---

To sign and verify JWTs a PEM encoded private key and a matching public key is required.
You can create a key-pair using the following command:
You can create a private key using the following command:
```sh
openssl genrsa -out private.pem 2048
```
To create a public key from a private key use following command:
```sh
openssl rsa -in private.pem -outform PEM -pubout -out public.pem

@@ -38,0 +45,0 @@ ```

@@ -13,4 +13,7 @@ ---

## Register custom fields for SAP Application Logging
In case you want to use this library with SAP Application Logging Service you need to register your custom fields.
This is necessary since custom fields will be reported in a fixed order so they can be ingested correctly in elasticsearch.
Please make sure to call the registration exactly once globally before logging any custom fields.
Registered fields will be indexed based on the order given by the provided field array.

@@ -23,5 +26,9 @@ ```js

```
## General use
As of version 6.5.0 this library will automatically detect which logging service you are bound to and will set the logging format accordingly.
For local testing purposes you can still enforce a specific format like this:
```js

@@ -33,2 +40,3 @@ log.overrideCustomFieldFormat("application-logging");

In addition to logging messages as described in [Message Logs](/cf-nodejs-logging-support/general-usage/message-logs) you can attach custom fields as an object of key-value pairs as last parameter:
```js

@@ -40,2 +48,3 @@ logger.info("My log message", {"field-a" :"value"});

In result messages will contain the custom fields specified to the logger instance in use.
```js

@@ -46,4 +55,5 @@ logger.setCustomFields({"field-a": "value"})

You can also set custom fields globally by calling the same function on the global `log` instance.
You can also set custom fields globally by calling the same function on the global `log` instance.
All logs, including request logs and logs by child loggers, will now contain the specified custom fields and values.
```js

@@ -54,4 +64,5 @@ log.setCustomFields({"field-b": "test"});

In case you want to remove custom fields from a logger instance you can provide an empty object:
```js
logger.setCustomFields({});
```
```

@@ -10,2 +10,7 @@ ---

## cf-nodejs-sample-app
To get a better understanding of how this library can be used to write request and message logs in actual Node.js applications take a look at our [cf-node-sample-app](https://github.com/SAP/cf-nodejs-logging-support/tree/master/sample/cf-nodejs-logging-support-sample).
The application shows buttons to test different features and can be deployed on Cloud Foundry.
## cf-nodejs-shoutboard

@@ -12,0 +17,0 @@

2

package.json
{
"name": "cf-nodejs-logging-support",
"version": "6.12.0",
"version": "6.13.0",
"description": "Logging tool for Cloud Foundry",

@@ -5,0 +5,0 @@ "keywords": [

@@ -16,2 +16,3 @@ var program = require('commander');

.option('-f, --keyfile <private-key-file>', 'a path to a file containing the private key')
.option('-p, --passphrase <passphrase>', 'private key passphrase (optional)')
.option('-v, --validityPeriod <days>', 'number of days the token will expire after')

@@ -79,3 +80,5 @@ .option('-i, --issuer <email-address>', 'valid issuer e-mail address')

var token = createToken(level, key, exp, issuer);
var passphrase = program.passphrase == undefined ? "" : program.passphrase;
var token = createToken(level, key, passphrase, exp, issuer);
if (token == null) {

@@ -97,7 +100,7 @@ console.log("\nError: Failed to create token. Please check key/keyfile and provided options.");

function validatePeriod(days) {
if (!isNaN(days)) {
return (days >= 1);
} else {
if (!isNaN(days)) {
return (days >= 1);
} else {
return null;
}
}
}

@@ -109,5 +112,5 @@

function createToken(level, key, exp, issuer) {
function createToken(level, key, passphrase, exp, issuer) {
try {
return jwt.sign({ level: level, exp: exp, issuer: issuer }, key, { algorithm: 'RS256'});
return jwt.sign({ level: level, exp: exp, issuer: issuer }, { key: key, passphrase: passphrase }, { algorithm: 'RS256' });
} catch (err) {

@@ -117,2 +120,2 @@ console.error(err);

}
}
}

Sorry, the diff of this file is not supported yet

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