MOBILE-3977 db: Implement method to log history
parent
fdd5d5d8a5
commit
effe53807a
|
@ -38,6 +38,17 @@ export class CoreDbProvider {
|
|||
return CoreAppProvider.isAutomated();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print query history in console.
|
||||
*/
|
||||
printHistory(): void {
|
||||
const substituteParams = ({ sql, params }: CoreDbQueryLog) =>
|
||||
Object.values(params ?? []).reduce((sql: string, param: string) => sql.replace('?', param), sql);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(this.queryLogs.map(substituteParams).join('\n'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a query.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue