Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "meadow", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "A data access library.", | ||
@@ -5,0 +5,0 @@ "main": "source/Meadow.js", |
@@ -36,3 +36,3 @@ // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system | ||
{ | ||
pMeadow.fable.log.warn('Slow Count query took ' + tmpProfileTime + 'ms', {Query: { Body: (pQuery.query ? pQuery.query.body : '') }}); | ||
pMeadow.logSlowQuery(tmpProfileTime, pQuery); | ||
} | ||
@@ -39,0 +39,0 @@ |
@@ -36,3 +36,3 @@ // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system | ||
{ | ||
pMeadow.fable.log.warn('Slow Read query took ' + tmpProfileTime + 'ms', {Query: { Body: (pQuery.query ? pQuery.query.body : '') }}); | ||
pMeadow.logSlowQuery(tmpProfileTime, pQuery); | ||
} | ||
@@ -39,0 +39,0 @@ |
@@ -276,2 +276,26 @@ // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system | ||
/** | ||
* Method to log slow queries in a consistent pattern | ||
*/ | ||
var logSlowQuery = function(pProfileTime, pQuery) | ||
{ | ||
var tmpQuery = pQuery.query || {body: '', parameters: {}}; | ||
var tmpFullQuery = tmpQuery.body; | ||
for (key in tmpQuery.parameters) | ||
{ | ||
tmpFullQuery = tmpFullQuery.replace(':' + key, tmpQuery.parameters[key]); | ||
} | ||
_Fable.log.warn('Slow Read query took ' + pProfileTime + 'ms', | ||
{ | ||
Provider: _ProviderName, | ||
Query: | ||
{ | ||
Body: tmpQuery.body, | ||
Parameters: tmpQuery.parameters, | ||
FullQuery: tmpFullQuery | ||
} | ||
}); | ||
} | ||
/** | ||
* Container Object for our Factory Pattern | ||
@@ -304,2 +328,4 @@ */ | ||
logSlowQuery: logSlowQuery, | ||
// Factory | ||
@@ -306,0 +332,0 @@ new: createNew |
@@ -170,2 +170,11 @@ /** | ||
( | ||
'Test log slow query method', | ||
function() | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
testMeadow.logSlowQuery(100, testMeadow.query); | ||
} | ||
); | ||
test | ||
( | ||
'Try to change to a bad provider', | ||
@@ -172,0 +181,0 @@ function() |
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
86455
2959