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

@meshwatch/logging

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meshwatch/logging - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

dist/meshwatch-logging-1.0.6.tgz

9

dist/logging.cjs.development.js

@@ -35,2 +35,3 @@ 'use strict';

const DEFAULT_LOG_LEVEL = 'INFO';
const LogLevelMappings = {

@@ -42,3 +43,2 @@ DEBUG: 0,

};
const DEFAULT_LOG_LEVEL = 'INFO';
const LAMBDA_CONTEXT = {

@@ -96,6 +96,7 @@ awsRegion: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION,

const logMsg = _extends({}, context, {}, params);
const logMsg = _extends({}, context, {}, params, {
level: levelName,
message
});
logMsg.level = levelName;
logMsg.message = message;
console.log(JSON.stringify(logMsg));

@@ -102,0 +103,0 @@ }

@@ -1,2 +0,2 @@

"use strict";var e,r=(e=require("util"))&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}const o=global;let s=()=>o.CONTEXT||{};const t=()=>!(!process.env.LAMBDA_TASK_ROOT||!process.env.AWS_EXECUTION_ENV),c={DEBUG:0,INFO:1,WARN:2,ERROR:3},a="INFO",E={awsRegion:process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION,functionName:process.env.AWS_LAMBDA_FUNCTION_NAME,functionVersion:process.env.AWS_LAMBDA_FUNCTION_VERSION,functionMemorySize:process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE,stage:process.env.ENVIRONMENT||process.env.STAGE},i=()=>{const e=s();return n({},E,{},e)},p=()=>{const e=s();return"true"===process.env.DEBUG_LOG||"true"===e["Debug-Log-Enabled"]},u=(e,r={})=>e?n({},r,{errorName:e.name,errorMessage:e.message,stackTrace:e.stack}):r;function O(e={}){const{logLevel:o}=e,s=()=>o||process.env.LOG_LEVEL||a,E=t()?function(e,r,o){const s=n({},i(),{},o);s.level=e,s.message=r,console.log(JSON.stringify(s))}:function(e,n,o){console.log(e,n,r.inspect(o,{depth:Infinity}))},O=(e,r,n={})=>{(e=>{const r=(e=>e>=c[s()])(c[e]),n=p();return!r&&!n})(e)||E(e,r,n)};return{info:(e,r)=>{O("INFO",e,r)},debug:(e,r)=>{O("DEBUG",e,r)},warn:(e,r,n)=>{O("WARN",e,u(r,n))},error:(e,r,n)=>{O("ERROR",e,u(r,n))}}}const v=O(),{DEBUG_SAMPLE_RATE:N="0.05"}=process.env;exports.createLogger=O,exports.debuggy=(({sampleRate:e=parseFloat(N)}={})=>{let r;return{before:(n,o)=>{Math.random()<=e&&(r=process.env.LOG_LEVEL,process.env.LOG_LEVEL="DEBUG"),o()},after:(e,n)=>{r&&(process.env.LOG_LEVEL=void 0),n()},onError:(e,r)=>{const{awsRequestId:n}=e.context,o=JSON.stringify(e.event);v.error("invocation failed",e.error,{awsRequestId:n,invocationEvent:o}),r(e.error)}}}),exports.logger=v;
"use strict";var e,r=(e=require("util"))&&"object"==typeof e&&"default"in e?e.default:e;function n(){return(n=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}const o=global;let s=()=>o.CONTEXT||{};const t=()=>!(!process.env.LAMBDA_TASK_ROOT||!process.env.AWS_EXECUTION_ENV),c="INFO",a={DEBUG:0,INFO:1,WARN:2,ERROR:3},E={awsRegion:process.env.AWS_REGION||process.env.AWS_DEFAULT_REGION,functionName:process.env.AWS_LAMBDA_FUNCTION_NAME,functionVersion:process.env.AWS_LAMBDA_FUNCTION_VERSION,functionMemorySize:process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE,stage:process.env.ENVIRONMENT||process.env.STAGE},i=()=>{const e=s();return n({},E,{},e)},p=()=>{const e=s();return"true"===process.env.DEBUG_LOG||"true"===e["Debug-Log-Enabled"]},u=(e,r={})=>e?n({},r,{errorName:e.name,errorMessage:e.message,stackTrace:e.stack}):r;function O(e={}){const{logLevel:o}=e,s=()=>o||process.env.LOG_LEVEL||c,E=t()?function(e,r,o){const s=n({},i(),{},o,{level:e,message:r});console.log(JSON.stringify(s))}:function(e,n,o){console.log(e,n,r.inspect(o,{depth:Infinity}))},O=(e,r,n={})=>{(e=>{const r=(e=>e>=a[s()])(a[e]),n=p();return!r&&!n})(e)||E(e,r,n)};return{info:(e,r)=>{O("INFO",e,r)},debug:(e,r)=>{O("DEBUG",e,r)},warn:(e,r,n)=>{O("WARN",e,u(r,n))},error:(e,r,n)=>{O("ERROR",e,u(r,n))}}}const v=O(),{DEBUG_SAMPLE_RATE:N="0.05"}=process.env;exports.createLogger=O,exports.debuggy=(({sampleRate:e=parseFloat(N)}={})=>{let r;return{before:(n,o)=>{Math.random()<=e&&(r=process.env.LOG_LEVEL,process.env.LOG_LEVEL="DEBUG"),o()},after:(e,n)=>{r&&(process.env.LOG_LEVEL=void 0),n()},onError:(e,r)=>{const{awsRequestId:n}=e.context,o=JSON.stringify(e.event);v.error("invocation failed",e.error,{awsRequestId:n,invocationEvent:o}),r(e.error)}}}),exports.logger=v;
//# sourceMappingURL=logging.cjs.production.min.js.map

@@ -31,2 +31,3 @@ import util from 'util';

const DEFAULT_LOG_LEVEL = 'INFO';
const LogLevelMappings = {

@@ -38,3 +39,2 @@ DEBUG: 0,

};
const DEFAULT_LOG_LEVEL = 'INFO';
const LAMBDA_CONTEXT = {

@@ -92,6 +92,7 @@ awsRegion: process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION,

const logMsg = _extends({}, context, {}, params);
const logMsg = _extends({}, context, {}, params, {
level: levelName,
message
});
logMsg.level = levelName;
logMsg.message = message;
console.log(JSON.stringify(logMsg));

@@ -98,0 +99,0 @@ }

@@ -0,1 +1,2 @@

import * as sinon from 'sinon';
/**

@@ -7,3 +8,3 @@ * Sinon Sandbox

*/
declare const sandbox: any;
declare const sandbox: sinon.SinonSandbox;
export default sandbox;
export declare type Dictionary<T> = {
[key: string]: T;
};
export declare type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
export declare type LogLevelMappings = {
[key in LogLevel]: number;
};
export declare type Logger = {

@@ -11,3 +15,3 @@ debug: (msg: string, params?: object) => void;

export declare type LoggerOptions = {
logLevel?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
logLevel?: LogLevel;
};
{
"name": "@meshwatch/logging",
"description": "NodeJS serverless logging",
"version": "1.0.5",
"version": "1.0.6",
"license": "UNLICENSED",

@@ -34,2 +34,3 @@ "source": "src/index.ts",

"@types/node": "^12.6.9",
"@types/sinon": "^7.0.13",
"@typescript-eslint/eslint-plugin": "^1.13.0",

@@ -36,0 +37,0 @@ "@typescript-eslint/parser": "^1.13.0",

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