New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@janiscommerce/log

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@janiscommerce/log - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

7

CHANGELOG.md

@@ -8,2 +8,9 @@ # Changelog

## [2.0.0] - 2019-12-05
### Added
- `service` field support, will use it if exists, or will use ENV service name otherwise.
### Changed
- log S3 key/path now includes `service` and `entity` prefixes
## [1.2.0] - 2019-10-11

@@ -10,0 +17,0 @@ ### Added

17

lib/log.js

@@ -73,5 +73,10 @@ 'use strict';

if(typeof this._serviceName === 'undefined')
throw new LogError('Unknown service name', LogError.codes.NO_SERVICE_NAME);
if(typeof log.service === 'undefined') {
if(typeof this._serviceName === 'undefined')
throw new LogError('Unknown service name', LogError.codes.NO_SERVICE_NAME);
log.service = this._serviceName;
}
if(typeof client !== 'string')

@@ -96,4 +101,4 @@ throw new LogError('Invalid or empty client', LogError.codes.INVALID_CLIENT);

Bucket: this.bucket,
Key: `${client}/${year}/${month}/${day}/${log.id}.json`,
Body: JSON.stringify({ ...log, service: this._serviceName }),
Key: `${client}/${year}/${month}/${day}/${log.service}/${log.entity}/${log.id}.json`,
Body: JSON.stringify(log),
ContentType: 'application/json'

@@ -109,2 +114,6 @@ }).promise();

// Should have service property with type string
if(typeof log.service !== 'string')
throw new LogError('Invalid log: should have a valid service name and must be a string', LogError.codes.INVALID_LOG);
// Should have entity property with type string

@@ -111,0 +120,0 @@ if(typeof log.entity !== 'string')

{
"name": "@janiscommerce/log",
"version": "1.2.0",
"version": "2.0.0",
"description": "A package for creating logs in S3",

@@ -5,0 +5,0 @@ "main": "lib/log.js",

@@ -25,2 +25,3 @@ # log

The `log [Object]` parameter have the following structure:
- **`service [String]`** (optional): The service name, if this field not exists, will be obtained from the ENV (**`JANIS_SERVICE_NAME`**)
- **`type [String|Number]`** (required): The log type

@@ -27,0 +28,0 @@ - **`entity [String]`** (required): The name of the entity that is creating the log

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