@mhlabs/structured-logging
Advanced tools
Comparing version 2.0.0-alpha to 2.0.1-alpha
{ | ||
"name": "@mhlabs/structured-logging", | ||
"version": "2.0.0-alpha", | ||
"version": "2.0.1-alpha", | ||
"description": "A package for logging to console in a structured format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,4 +20,11 @@ let stack = 'default-stack'; | ||
Level: logLevel, | ||
Metadata: metadata | ||
Stack: stack | ||
}; | ||
Object.keys(metadata).forEach(key => { | ||
if (!data[key]) { | ||
data[key] = metadata[key]; | ||
} | ||
}); | ||
return JSON.stringify(data); | ||
@@ -63,3 +70,2 @@ } | ||
silentMode = false; | ||
baseMetadata.stack = stack; | ||
@@ -66,0 +72,0 @@ this.setSilentMode = silent => { |
@@ -14,3 +14,3 @@ const StructuredLogger = require('./structuredLogger'); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"INFO","Metadata":{"entityId":"123","stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"INFO","Stack":"virtual-test-stack","entityId":"123"}' | ||
); | ||
@@ -22,3 +22,3 @@ }); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"WARN","Metadata":{"entityId":"123","stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"WARN","Stack":"virtual-test-stack","entityId":"123"}' | ||
); | ||
@@ -30,3 +30,3 @@ }); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Metadata":{"entityId":"123","stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Stack":"virtual-test-stack","entityId":"123"}' | ||
); | ||
@@ -38,3 +38,3 @@ }); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"ERROR","Metadata":{"entityId":"123","stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"ERROR","Stack":"virtual-test-stack","entityId":"123"}' | ||
); | ||
@@ -49,3 +49,3 @@ }); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Metadata":{"memberId":123,"orderId":321,"stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Stack":"virtual-test-stack","memberId":123,"orderId":321}' | ||
); | ||
@@ -57,3 +57,3 @@ }); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Metadata":{"stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Stack":"virtual-test-stack"}' | ||
); | ||
@@ -65,3 +65,3 @@ }); | ||
expect(log).toEqual( | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Metadata":{"stack":"virtual-test-stack"}}' | ||
'{"Message":"My name is Bond, James Bond.","Level":"DEBUG","Stack":"virtual-test-stack"}' | ||
); | ||
@@ -68,0 +68,0 @@ }); |
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
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
164
5620