@eik/service 2.0.164 → 2.1.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/CHANGELOG.md +7 -0
- package/lib/main.js +10 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [2.1.0](https://github.com/eik-lib/service/compare/v2.0.164...v2.1.0) (2024-07-31)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* allow passing in a pino instance ([#577](https://github.com/eik-lib/service/issues/577)) ([2161f83](https://github.com/eik-lib/service/commit/2161f833dd63b4321fe54b27e3926011eb2886e2))
|
7
|
+
|
1
8
|
## [2.0.164](https://github.com/eik-lib/service/compare/v2.0.163...v2.0.164) (2024-07-31)
|
2
9
|
|
3
10
|
|
package/lib/main.js
CHANGED
@@ -15,6 +15,7 @@ import * as utils from './utils.js';
|
|
15
15
|
/**
|
16
16
|
* @typedef {object} EikServiceOptions
|
17
17
|
* @property {import('@eik/sink').default} [sink]
|
18
|
+
* @property {import('pino').Logger} [logger]
|
18
19
|
* @property {import('@eik/sink').default} [customSink] [Deprecated] Use sink instead
|
19
20
|
* @property {string} [aliasCacheControl]
|
20
21
|
* @property {string} [notFoundCacheControl="public, max-age=5"]
|
@@ -25,18 +26,21 @@ const EikService = class EikService {
|
|
25
26
|
* @param {EikServiceOptions} [options={}]
|
26
27
|
*/
|
27
28
|
constructor(options = {}) {
|
28
|
-
let { sink } = options;
|
29
|
+
let { sink, logger } = options;
|
29
30
|
const {
|
30
31
|
customSink,
|
31
32
|
notFoundCacheControl,
|
32
33
|
aliasCacheControl,
|
33
34
|
} = options;
|
34
35
|
this._notFoundCacheControl = notFoundCacheControl || 'public, max-age=5';
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
|
37
|
+
if (!logger) {
|
38
|
+
logger = pino({
|
39
|
+
// @ts-ignore
|
40
|
+
level: config.get('log.level'),
|
41
|
+
name: config.get('name'),
|
42
|
+
});
|
43
|
+
}
|
40
44
|
|
41
45
|
if (customSink) {
|
42
46
|
logger.warn('The `customSink` option is deprecated and will be removed at a later stage. Use `sink` to remove this warning.');
|