Skip to content

Commit

Permalink
fix(logging): from changes in @sap/cds (#791)
Browse files Browse the repository at this point in the history
We should change all occurences to

```js
const LOG = cds.log('db|sql')
if (LOG._debug) LOG.debug(...)
```
  • Loading branch information
David-Kunz authored Aug 30, 2024
1 parent c38a9e6 commit 1e8bf06
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions db-service/lib/cqn2sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ const BINARY_TYPES = {
const { Readable } = require('stream')

const DEBUG = (() => {
let DEBUG = cds.debug('sql-json')
if (DEBUG) return DEBUG
else DEBUG = cds.debug('sql|sqlite')
if (DEBUG) {
return DEBUG
const LOG = cds.log('sql-json')
if (LOG._debug) return cds.debug('sql-json')
return cds.debug('sql|sqlite')
//if (DEBUG) {
// return DEBUG
// (sql, ...more) => DEBUG (sql.replace(/(?:SELECT[\n\r\s]+(json_group_array\()?[\n\r\s]*json_insert\((\n|\r|.)*?\)[\n\r\s]*\)?[\n\r\s]+as[\n\r\s]+_json_[\n\r\s]+FROM[\n\r\s]*\(|\)[\n\r\s]*(\)[\n\r\s]+AS )|\)$)/gim,(a,b,c,d) => d || ''), ...more)
// FIXME: looses closing ) on INSERT queries
}
//}
})()

class CQN2SQLRenderer {
Expand Down

0 comments on commit 1e8bf06

Please sign in to comment.