@ejfdelgado/ejflab-back 1.31.0 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-back",
3
- "version": "1.31.0",
3
+ "version": "1.31.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
@@ -1,6 +1,7 @@
1
1
  import pg from "pg";
2
2
  import fs from "fs";
3
3
  import { MyTemplate } from "@ejfdelgado/ejflab-common/src/MyTemplate.js";
4
+ import { consoleSrv } from "./ConsoleSrv.mjs";
4
5
  const { Pool } = pg;
5
6
 
6
7
  export class PostgresSrv {
@@ -113,7 +114,7 @@ export class PostgresSrv {
113
114
 
114
115
  static async executeText(sql, model = {}, client = null) {
115
116
  const sqlRendered = PostgresSrv.renderer.render(sql, model);
116
- console.log(sqlRendered);
117
+ consoleSrv.log(sqlRendered);
117
118
  let localClient = false;
118
119
  if (!client) {
119
120
  const pool = await PostgresSrv.getPool();
@@ -149,10 +150,10 @@ export class PostgresSrv {
149
150
  });
150
151
  PostgresSrv.pool.on('error', (err) => {
151
152
  // try reconnect given the tipe of error
152
- console.log("-------------------------------------");
153
- console.log("------------------ Handling error ---");
154
- console.log("-------------------------------------");
155
- console.log(JSON.stringify(err.message));
153
+ consoleSrv.error("-------------------------------------");
154
+ consoleSrv.error("------------------ Handling error ---");
155
+ consoleSrv.error("-------------------------------------");
156
+ consoleSrv.error(JSON.stringify(err.message));
156
157
  if (err.message == "read ETIMEDOUT") {
157
158
  PostgresSrv.createPool();
158
159
  }
@@ -217,9 +218,9 @@ export class PostgresSrv {
217
218
  throw new Error(`Test ${i + 1} In: ${actual.in} Actual: ${returned} but expected ${actual.expected}`);
218
219
  }
219
220
  }
220
- console.log(`Test passed ${testsNumber.length}!`);
221
+ consoleSrv.log(`Test passed ${testsNumber.length}!`);
221
222
 
222
- //console.log(PostgresSrv.renderer.render('Hola ${name} with age ${age | sanitizeNumber : 0}', {name: "Edgar", age: undefined}));
223
+ //consoleSrv.log(PostgresSrv.renderer.render('Hola ${name} with age ${age | sanitizeNumber : 0}', {name: "Edgar", age: undefined}));
223
224
  }
224
225
  }
225
226