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

@join-com/gcloud-logger

Package Overview
Dependencies
Maintainers
33
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@join-com/gcloud-logger - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1-alpha.1

21

__tests__/Logger.ts
import { Logger } from '../src'
describe('logger', () => {
afterEach(() => jest.resetAllMocks())
it('truncates field over maxFieldLength', () => {

@@ -20,2 +22,19 @@ const stdoutSpy = jest.spyOn(process.stdout, 'write');

})
})
it('ignores provided max field length if warning', () => {
const stdoutSpy = jest.spyOn(process.stdout, 'write')
const logger = new Logger(true, 'DEBUG', [], 5)
logger.warn('msg', { response: { some: 'longWord' } })
const log = '{"response":{"some":"longWord"},"message":"msg","severity":"WARNING","level":400}\n'
expect(stdoutSpy).toHaveBeenCalledWith(log)
})
it('truncates field over maxFieldLengthForError if warning', () => {
const stdoutSpy = jest.spyOn(process.stdout, 'write')
const logger = new Logger(true, 'DEBUG', [], 5)
logger.warn('msg', { response: { some: 'x'.repeat(8000) } })
expect(stdoutSpy.mock.calls[0]?.[0].length).toBeLessThan(4100)
})
})

3

dist/index.js

@@ -8,3 +8,4 @@ "use strict";

Object.defineProperty(exports, "Level", { enumerable: true, get: function () { return Logger_2.Level; } });
exports.logger = new Logger_1.Logger(process.env['NODE_ENV'] === 'production', process.env['LOG_LEVEL'], undefined, parseInt(process.env['LOG_MAX_FIELD_LENGTH'] ?? '', 10));
const DEFAULT_MAX_LENGTH = '1000';
exports.logger = new Logger_1.Logger(process.env['NODE_ENV'] === 'production', process.env['LOG_LEVEL'], undefined, parseInt(process.env['LOG_MAX_FIELD_LENGTH'] ?? DEFAULT_MAX_LENGTH, 10));
const reportError = (e) => {

@@ -11,0 +12,0 @@ exports.logger.reportError(e);

@@ -176,3 +176,3 @@ "use strict";

if (obj.length > maxLength) {
return obj.substring(0, this.maxFieldLength) + '...TRUNCATED';
return obj.substring(0, maxLength) + '...TRUNCATED';
}

@@ -179,0 +179,0 @@ }

{
"name": "@join-com/gcloud-logger",
"version": "1.6.0",
"version": "1.6.1-alpha.1",
"description": "gcloud simple logger",

@@ -5,0 +5,0 @@ "author": "JOIN Solutions",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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