ac-logger 3.0.1 → 3.0.3
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 +23 -0
- package/index.js +41 -14
- package/mocha-reporter-config.json +7 -0
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.3](https://github.com/admiralcloud/ac-logger/compare/v3.0.2..v3.0.3) (2026-01-19 12:04:04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fix
|
|
6
|
+
|
|
7
|
+
* **App:** Package updates | MP | [b9138bdefc30c77c1d6eccc6ff2d5b8ad28dc407](https://github.com/admiralcloud/ac-logger/commit/b9138bdefc30c77c1d6eccc6ff2d5b8ad28dc407)
|
|
8
|
+
Packge updates
|
|
9
|
+
Related issues:
|
|
10
|
+
|
|
11
|
+
## [3.0.2](https://github.com/admiralcloud/ac-logger/compare/v3.0.1..v3.0.2) (2025-05-01 06:45:16)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fix
|
|
15
|
+
|
|
16
|
+
* **App:** Add option to retrieve logs without sending to stdout | MP | [d42bb231fff0123d4c6f52d638fd69720af0f598](https://github.com/admiralcloud/ac-logger/commit/d42bb231fff0123d4c6f52d638fd69720af0f598)
|
|
17
|
+
You can use function with collectOnly option to just retrieve the log info
|
|
18
|
+
Related issues:
|
|
19
|
+
### Chores
|
|
20
|
+
|
|
21
|
+
* **App:** Updated packages | MP | [7b16ae721587e1d9eace2d9117e0771339e2ef6c](https://github.com/admiralcloud/ac-logger/commit/7b16ae721587e1d9eace2d9117e0771339e2ef6c)
|
|
22
|
+
Updated packages
|
|
23
|
+
Related issues:
|
|
24
|
+
|
|
2
25
|
## [3.0.1](https://github.com/admiralcloud/ac-logger/compare/v3.0.0..v3.0.1) (2025-04-19 17:49:39)
|
|
3
26
|
|
|
4
27
|
|
package/index.js
CHANGED
|
@@ -198,22 +198,36 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
|
|
|
198
198
|
acLogger.info(_.repeat('-', length))
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
const bootstrapInfo = ({ appName = 'App name missing', branch }) => {
|
|
201
|
+
const bootstrapInfo = ({ appName = 'App name missing', branch, collectOnly = false }) => {
|
|
202
202
|
const pwd = process.cwd()
|
|
203
203
|
const pjson = require(path.resolve(pwd, 'package.json'))
|
|
204
204
|
const environment = process.env.NODE_ENV || 'development'
|
|
205
205
|
const padLength = 15
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
206
|
+
if (collectOnly) {
|
|
207
|
+
const logCollector = []
|
|
208
|
+
logCollector.push({ field: 'Environment', value: environment, padLength })
|
|
209
|
+
if (branch) {
|
|
210
|
+
logCollector.push({ field: 'Branch', value: branch, padLength })
|
|
211
|
+
}
|
|
212
|
+
logCollector.push({ field: 'Version', value: pjson.version, padLength })
|
|
213
|
+
logCollector.push({ field: 'AppName', value: appName, padLength })
|
|
214
|
+
logCollector.push({ field: 'BOOTSTRAPPING', value: '\x1b[32mSuccessful\x1b[0m', padLength })
|
|
215
|
+
return logCollector
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
acLogger.info('')
|
|
219
|
+
hrLine()
|
|
220
|
+
listing({ field: 'Time', value: moment().format('YYYY-MM-DD HH:mm:ss'), padLength })
|
|
221
|
+
listing({ field: 'Environment', value: environment, padLength })
|
|
222
|
+
if (branch) {
|
|
223
|
+
listing({ field: 'Branch', value: branch, padLength })
|
|
224
|
+
}
|
|
225
|
+
listing({ field: 'Version', value: pjson.version, padLength })
|
|
226
|
+
listing({ field: 'AppName', value: appName, padLength })
|
|
227
|
+
acLogger.info('')
|
|
228
|
+
listing({ field: 'BOOTSTRAPPING', value: '\x1b[32mSuccessful\x1b[0m', padLength })
|
|
229
|
+
hrLine()
|
|
230
|
+
}
|
|
217
231
|
}
|
|
218
232
|
|
|
219
233
|
/**
|
|
@@ -222,13 +236,26 @@ module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss',
|
|
|
222
236
|
* and connection
|
|
223
237
|
*/
|
|
224
238
|
const serverInfo = (params) => {
|
|
239
|
+
const { collectOnly } = params
|
|
240
|
+
const logCollector = []
|
|
225
241
|
const fields = ['instance', 'server', 'host', 'port', 'version', 'cluster', 'clusterVersion', 'ssl', 'db', 'database', 'index', 'user']
|
|
226
242
|
_.forEach(fields, field => {
|
|
227
243
|
if (_.get(params, field)) {
|
|
228
|
-
|
|
244
|
+
if (collectOnly) {
|
|
245
|
+
logCollector.push({ field: _.upperFirst(field), value: _.get(params, field) })
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
listing({ field: _.upperFirst(field), value: _.get(params, field) })
|
|
249
|
+
}
|
|
229
250
|
}
|
|
230
251
|
})
|
|
231
|
-
|
|
252
|
+
if (collectOnly) {
|
|
253
|
+
logCollector.push({ field: 'Connection', value: '\x1b[32mSuccessful\x1b[0m' })
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
listing({ field: 'Connection', value: '\x1b[32mSuccessful\x1b[0m' })
|
|
257
|
+
}
|
|
258
|
+
return logCollector
|
|
232
259
|
}
|
|
233
260
|
|
|
234
261
|
|
package/package.json
CHANGED
|
@@ -3,24 +3,25 @@
|
|
|
3
3
|
"author": "Mark Poepping (https://www.admiralcloud.com)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "admiralcloud/ac-logger",
|
|
6
|
-
"version": "3.0.
|
|
6
|
+
"version": "3.0.3",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"lodash": "^4.17.21",
|
|
9
9
|
"moment": "^2.30.1",
|
|
10
|
-
"winston": "^3.
|
|
10
|
+
"winston": "^3.19.0",
|
|
11
11
|
"winston-daily-rotate-file": "^5.0.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"ac-semantic-release": "^0.4.
|
|
14
|
+
"ac-semantic-release": "^0.4.8",
|
|
15
15
|
"chai": "^4.5.0",
|
|
16
|
-
"eslint": "^9.
|
|
16
|
+
"eslint": "^9.39.2",
|
|
17
17
|
"intercept-stdout": "^0.1.2",
|
|
18
|
-
"mocha": "^11.
|
|
19
|
-
"mocha-
|
|
18
|
+
"mocha": "^11.7.5",
|
|
19
|
+
"mocha-junit-reporter": "^2.2.1",
|
|
20
|
+
"mocha-multi-reporters": "^1.5.1"
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"test": "mocha --reporter spec",
|
|
23
|
-
"test-jenkins": "JUNIT_REPORT_PATH=./report.xml mocha --colors --reporter mocha-
|
|
24
|
+
"test-jenkins": "JUNIT_REPORT_PATH=./report.xml mocha --colors --reporter mocha-multi-reporters --reporter-options configFile=mocha-reporter-config.json"
|
|
24
25
|
},
|
|
25
26
|
"engines": {
|
|
26
27
|
"node": ">=18.0.0"
|