@defra/bng-utils-lib 0.273.11 → 0.275.0
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": "@defra/bng-utils-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.275.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "A library of utilities for the Biodiversity Net Gain Service",
|
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
"license": "OGL-UK-3.0",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@azure/identity": "^4.0.0",
|
|
17
|
-
"@defra/bng-connectors-lib": "
|
|
18
|
-
"axios": "^1.6.2"
|
|
19
|
-
"pino": "^8.17.2",
|
|
20
|
-
"pino-pretty": "10.3.1"
|
|
17
|
+
"@defra/bng-connectors-lib": "0.275.0",
|
|
18
|
+
"axios": "^1.6.2"
|
|
21
19
|
},
|
|
22
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "b97e797e4547ed5de11d127a5851810ad631f637"
|
|
23
21
|
}
|
package/src/utils.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import getBearerToken from './helpers/get-bearer-token.js'
|
|
2
2
|
import getDBConnection from './helpers/get-db-connection.js'
|
|
3
|
-
import logger from './helpers/logger.js'
|
|
4
|
-
import loggerOptions from './helpers/logger-options.js'
|
|
5
3
|
|
|
6
|
-
export { getBearerToken, getDBConnection
|
|
4
|
+
export { getBearerToken, getDBConnection }
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import logger from '../logger.js'
|
|
2
|
-
|
|
3
|
-
// Adapted from https://stackoverflow.com/questions/44890836/how-to-test-console-log-output-using-jest-or-other-javascript-testing-framework
|
|
4
|
-
describe('The logger', () => {
|
|
5
|
-
it('should log output', async () => {
|
|
6
|
-
const mockLogText = 'mock log text'
|
|
7
|
-
const loggedData = []
|
|
8
|
-
const storeLogOutput = input => loggedData.push(input)
|
|
9
|
-
logger.info = jest.fn(storeLogOutput)
|
|
10
|
-
logger.info(mockLogText)
|
|
11
|
-
expect(loggedData).toContain(mockLogText)
|
|
12
|
-
})
|
|
13
|
-
})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const loggerOptions = {
|
|
2
|
-
options: {
|
|
3
|
-
logPayload: true,
|
|
4
|
-
level: 'warn',
|
|
5
|
-
redact: {
|
|
6
|
-
paths: ['req.headers.authorization', 'req.headers.cookie', 'res.headers'],
|
|
7
|
-
remove: true
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (process.env.NODE_ENV === 'development') {
|
|
13
|
-
loggerOptions.options.transport = {
|
|
14
|
-
target: 'pino-pretty',
|
|
15
|
-
options: {
|
|
16
|
-
colorize: true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default loggerOptions
|