@apolitical/logger 2.1.1 → 3.0.0-bht.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/README.md +1 -1
- package/package.json +3 -5
- package/src/config.js +1 -5
- package/src/services/logger.service.js +9 -15
- package/CHANGELOG.md +0 -68
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apolitical/logger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-bht.0",
|
|
4
4
|
"description": "Node.js module to expose Apolitical's logger service",
|
|
5
5
|
"author": "Apolitical Group Limited <engineering@apolitical.co>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"lint": "eslint --ext .js ./src",
|
|
16
16
|
"format": "prettier --write 'src/**/*.+(js|json)'",
|
|
17
17
|
"lint-format": "lint-staged",
|
|
18
|
-
"audit": "audit-ci -h"
|
|
19
|
-
"prepare": "husky install"
|
|
18
|
+
"audit": "audit-ci -h"
|
|
20
19
|
},
|
|
21
20
|
"keywords": [
|
|
22
21
|
"Backend",
|
|
@@ -31,13 +30,12 @@
|
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@apolitical/eslint-config": "2.1.0",
|
|
33
32
|
"audit-ci": "6.5.0",
|
|
34
|
-
"husky": "8.0.3",
|
|
35
33
|
"jest": "29.3.1",
|
|
36
34
|
"jest-junit": "15.0.0",
|
|
37
35
|
"lint-staged": "13.1.0"
|
|
38
36
|
},
|
|
39
37
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
38
|
+
"node": ">=20.14.0"
|
|
41
39
|
},
|
|
42
40
|
"eslintConfig": {
|
|
43
41
|
"extends": "@apolitical/eslint-config/api.config"
|
package/src/config.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { NODE_ENV } = process.env;
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
|
-
GOOGLE: {
|
|
7
|
-
CLOUD_FUNCTION: GOOGLE_CLOUD_FUNCTION,
|
|
8
|
-
CREDENTIALS: GOOGLE_APPLICATION_CREDENTIALS,
|
|
9
|
-
},
|
|
10
6
|
LOGGER: {
|
|
11
7
|
LOGGING_LEVELS: ['error', 'warn', 'info', 'debug'],
|
|
12
8
|
TRANSPORTS: {
|
|
@@ -5,8 +5,6 @@ module.exports =
|
|
|
5
5
|
({ labels = {}, logLevel = 'info' }) => {
|
|
6
6
|
const { LOGGING_LEVELS } = config.LOGGER;
|
|
7
7
|
const { ERROR_OPTIONS, COMBINED_OPTIONS } = config.LOGGER.TRANSPORTS.FILE;
|
|
8
|
-
const { CLOUD_FUNCTION, CREDENTIALS } = config.GOOGLE;
|
|
9
|
-
|
|
10
8
|
function loggingLevels() {
|
|
11
9
|
return LOGGING_LEVELS.reduce((acc, cv, idx) => {
|
|
12
10
|
acc[cv] = idx;
|
|
@@ -17,19 +15,15 @@ module.exports =
|
|
|
17
15
|
function loggerTransports() {
|
|
18
16
|
const transports = [];
|
|
19
17
|
if (config.NODE_ENV === 'production') {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
30
|
-
} else {
|
|
31
|
-
transports.push(new winston.transports.Console());
|
|
32
|
-
}
|
|
18
|
+
transports.push(
|
|
19
|
+
new winstonGoogle.LoggingWinston({
|
|
20
|
+
labels,
|
|
21
|
+
serviceContext: {
|
|
22
|
+
service: labels.name,
|
|
23
|
+
version: labels.version,
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
33
27
|
} else {
|
|
34
28
|
transports.push(new winston.transports.Console());
|
|
35
29
|
transports.push(new winston.transports.File(ERROR_OPTIONS));
|
package/CHANGELOG.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [2.1.1] - 2023-01-31
|
|
9
|
-
### Added
|
|
10
|
-
- Renovate config file
|
|
11
|
-
|
|
12
|
-
## [2.1.0] - 2023-01-09
|
|
13
|
-
### Changed
|
|
14
|
-
- Bump dependencies to keep the project up-to-date
|
|
15
|
-
|
|
16
|
-
## [2.0.2] - 2022-06-28
|
|
17
|
-
### Changed
|
|
18
|
-
- Pipeline refs
|
|
19
|
-
|
|
20
|
-
## [2.0.1] - 2022-01-31
|
|
21
|
-
### Fixed
|
|
22
|
-
- Node.js version
|
|
23
|
-
|
|
24
|
-
## [2.0.0] - 2022-01-18
|
|
25
|
-
### Changed
|
|
26
|
-
- Updated dependencies
|
|
27
|
-
- Upgraded Node.js version
|
|
28
|
-
- Revamped GitLab pipelines
|
|
29
|
-
- Renamed `metadata` to `labels` to allow consistency with logger middleware
|
|
30
|
-
### Added
|
|
31
|
-
- Exposed logger middleware
|
|
32
|
-
### Removed
|
|
33
|
-
- Filtered winston logger functionality
|
|
34
|
-
- Restricted metadata
|
|
35
|
-
|
|
36
|
-
## [1.0.2] - 2021-07-08
|
|
37
|
-
### Updated
|
|
38
|
-
- Dependencies
|
|
39
|
-
|
|
40
|
-
## [1.0.1] - 2021-04-23
|
|
41
|
-
### Added
|
|
42
|
-
- Cloud function support
|
|
43
|
-
|
|
44
|
-
## [1.0.0] - 2021-02-08
|
|
45
|
-
### Bumped
|
|
46
|
-
- First version under `@apolitical`
|
|
47
|
-
### Fixed
|
|
48
|
-
- Production transport with Google Winston
|
|
49
|
-
|
|
50
|
-
## [0.0.5] - 2020-09-02
|
|
51
|
-
### Updated
|
|
52
|
-
- Readme
|
|
53
|
-
|
|
54
|
-
## [0.0.4] - 2020-09-02
|
|
55
|
-
### Updated
|
|
56
|
-
- Gitlab CI/CD pipeline
|
|
57
|
-
|
|
58
|
-
## [0.0.3] - 2020-08-25
|
|
59
|
-
### Changed
|
|
60
|
-
- Package lint and test dependencies
|
|
61
|
-
|
|
62
|
-
## [0.0.2] - 2020-07-30
|
|
63
|
-
### Fixed
|
|
64
|
-
- Index file to export logger
|
|
65
|
-
|
|
66
|
-
## [0.0.1] - 2020-07-30
|
|
67
|
-
### Added
|
|
68
|
-
- Initial setup
|