Logger: rename 'error' => 'exception' to avoid name clashing in E/S
This commit is contained in:
parent
3102d895f2
commit
b9198b59a1
@ -236,7 +236,7 @@ function createTemplateMaps ({ redisPool, surrogateKeysCache, logger }) {
|
||||
const startTime = Date.now();
|
||||
surrogateKeysCache.invalidate(new NamedMapsCacheEntry(user, templateName), (err) => {
|
||||
if (err) {
|
||||
return logger.error({ error: err, 'cdb-user': user, template_id: templateName }, 'Named map invalidation failed');
|
||||
return logger.error({ exception: err, 'cdb-user': user, template_id: templateName }, 'Named map invalidation failed');
|
||||
}
|
||||
|
||||
logger.info({ 'cdb-user': user, template_id: templateName, duration: (Date.now() - startTime) / 1000 }, 'Named map invalidation success');
|
||||
|
@ -343,7 +343,7 @@ function incrementMapViews ({ metadataBackend }) {
|
||||
|
||||
mapConfigProvider.getMapConfig((err, mapConfig) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Failed to increment mapview count');
|
||||
logger.warn({ exception: err }, 'Failed to increment mapview count');
|
||||
return next();
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ function incrementMapViews ({ metadataBackend }) {
|
||||
|
||||
metadataBackend.incMapviewCount(user, statTag, (err) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Failed to increment mapview count');
|
||||
logger.warn({ exception: err }, 'Failed to increment mapview count');
|
||||
}
|
||||
|
||||
next();
|
||||
|
@ -10,7 +10,7 @@ module.exports = function setCacheChannelHeader () {
|
||||
|
||||
mapConfigProvider.getAffectedTables((err, affectedTables) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Error generating Cache Channel Header');
|
||||
logger.warn({ exception: err }, 'Error generating Cache Channel Header');
|
||||
return next();
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ module.exports = function setCacheControlHeader ({
|
||||
|
||||
mapConfigProvider.getAffectedTables((err, affectedTables) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Error generating Cache Control Header');
|
||||
logger.warn({ exception: err }, 'Error generating Cache Control Header');
|
||||
return next();
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ module.exports = function errorMiddleware (/* options */) {
|
||||
const { logger } = res.locals;
|
||||
const errors = populateLimitErrors(Array.isArray(err) ? err : [err]);
|
||||
|
||||
errors.forEach((err) => logger.error({ error: err }, 'Error while handling the request'));
|
||||
errors.forEach((err) => logger.error({ exception: err }, 'Error while handling the request'));
|
||||
|
||||
setCommonHeaders(req, res, () => {
|
||||
const errorResponseBody = {
|
||||
|
@ -7,7 +7,7 @@ module.exports = function incrementMapViewCount (metadataBackend) {
|
||||
|
||||
metadataBackend.incMapviewCount(user, statTag, (err) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Failed to increment mapview count');
|
||||
logger.warn({ exception: err }, 'Failed to increment mapview count');
|
||||
}
|
||||
|
||||
next();
|
||||
|
@ -21,7 +21,7 @@ module.exports = function setLastModifiedHeader () {
|
||||
|
||||
mapConfigProvider.getAffectedTables((err, affectedTables) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Error generating Last Modified Header');
|
||||
logger.warn({ exception: err }, 'Error generating Last Modified Header');
|
||||
return next();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ module.exports = function metrics ({ enabled, tags, metricsBackend }) {
|
||||
const { event, attributes } = getEventData(req, res, tags);
|
||||
|
||||
metricsBackend.send(event, attributes)
|
||||
.catch((err) => logger.error({ error: err, event }, 'Failed to publish event'));
|
||||
.catch((err) => logger.error({ exception: err, event }, 'Failed to publish event'));
|
||||
});
|
||||
|
||||
return next();
|
||||
|
@ -17,7 +17,7 @@ module.exports = function setSurrogateKeyHeader ({ surrogateKeysCache }) {
|
||||
|
||||
mapConfigProvider.getAffectedTables((err, affectedTables) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Error generating Surrogate Key Header');
|
||||
logger.warn({ exception: err }, 'Error generating Surrogate Key Header');
|
||||
return next();
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ TurboCartoAdapter.prototype._parseCartoCss = function (username, params, layer,
|
||||
context: err.context
|
||||
};
|
||||
|
||||
return callback(null, { error: error });
|
||||
return callback(null, { exception: error });
|
||||
}
|
||||
|
||||
// Try to continue in the rest of the cases
|
||||
|
@ -39,7 +39,7 @@ module.exports = function setCommonHeaders (req, res, callback) {
|
||||
|
||||
getStatTag({ res }, (err, statTag) => {
|
||||
if (err) {
|
||||
logger.warn({ error: err }, 'Error generating Stat Tag header');
|
||||
logger.warn({ exception: err }, 'Error generating Stat Tag header');
|
||||
}
|
||||
|
||||
if (statTag) {
|
||||
@ -99,7 +99,7 @@ function getTemplateHash ({ res }) {
|
||||
try {
|
||||
templateHash = res.locals.mapConfigProvider.getTemplateHash().substring(0, 8);
|
||||
} catch (err) {
|
||||
logger.warn({ error: err }, 'Error generating Stat Tag header');
|
||||
logger.warn({ exception: err }, 'Error generating Stat Tag header');
|
||||
}
|
||||
|
||||
return templateHash;
|
||||
|
@ -29,7 +29,7 @@ module.exports = class Logger {
|
||||
serializers: {
|
||||
client_request: requestSerializer,
|
||||
server_response: responseSerializer,
|
||||
error: errorSerializer
|
||||
exception: errorSerializer
|
||||
}
|
||||
};
|
||||
const dest = pino.destination({ sync: false }); // stdout
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -814,7 +814,7 @@
|
||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
|
||||
},
|
||||
"camshaft": {
|
||||
"version": "github:cartodb/camshaft#a2bc005a0010f174a68d49d7c2f35020404db69e",
|
||||
"version": "github:cartodb/camshaft#0fde77351f4efef767e758aa1160e22d2ef6e65f",
|
||||
"from": "github:cartodb/camshaft#feature/ch91877/remove-log-aggregation-in-metro",
|
||||
"requires": {
|
||||
"async": "^1.5.2",
|
||||
|
Loading…
Reference in New Issue
Block a user