@coast/logger
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -33,7 +33,46 @@ "use strict"; | ||
}) | ||
}]; // create default logger instance | ||
}]; // serializer to pull useful fields from the req object | ||
function reqSerializer(req) { | ||
if (!req || !req.connection) { | ||
return req; | ||
} | ||
var method = req.method, | ||
url = req.url, | ||
headers = req.headers, | ||
_req$connection = req.connection, | ||
remoteAddress = _req$connection.remoteAddress, | ||
remotePort = _req$connection.remotePort; | ||
return { | ||
method: method, | ||
url: url, | ||
headers: headers, | ||
remoteAddress: remoteAddress, | ||
remotePort: remotePort | ||
}; | ||
} // serializer to pull useful fields from the res object | ||
function resSerializer(res) { | ||
if (!res || !res.statusCode) { | ||
return res; | ||
} | ||
return { | ||
statusCode: res.statusCode, | ||
header: res._header | ||
}; | ||
} // create default logger instance | ||
var Logger = _bunyan["default"].createLogger({ | ||
name: process.env.APP_NAME || 'API', | ||
streams: streams | ||
streams: streams, | ||
serializers: { | ||
req: reqSerializer, | ||
res: resSerializer, | ||
error: _bunyan["default"].stdSerializers.err, | ||
err: _bunyan["default"].stdSerializers.err | ||
} | ||
}); | ||
@@ -40,0 +79,0 @@ |
{ | ||
"name": "@coast/logger", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A Node/browser application logger", | ||
@@ -23,12 +23,12 @@ "main": "./dist/main.js", | ||
"devDependencies": { | ||
"@babel/cli": "^7.5.0", | ||
"@babel/core": "^7.5.4", | ||
"@babel/preset-env": "^7.5.4", | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@babel/preset-env": "^7.5.5", | ||
"babel-eslint": "^10.0.2", | ||
"eslint": "^6.0.1", | ||
"eslint": "^6.1.0", | ||
"eslint-config-airbnb": "^17.1.1", | ||
"eslint-plugin-import": "^2.18.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.14.2", | ||
"lodash": "^4.17.14", | ||
"eslint-plugin-react": "^7.14.3", | ||
"lodash": "^4.17.15", | ||
"rimraf": "^2.6.3", | ||
@@ -52,2 +52,3 @@ "semantic-release": "^15.13.18", | ||
"comma-dangle": ["error", "never"], | ||
"no-underscore-dangle": 0, | ||
"object-curly-newline": ["error", { | ||
@@ -54,0 +55,0 @@ "ObjectExpression": { "multiline": true }, |
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
8395
62