ac-logger 2.0.0 → 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 +20 -0
- package/index.js +8 -8
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
<a name="2.1.0"></a>
|
|
2
|
+
|
|
3
|
+
# [2.1.0](https://github.com/admiralcloud/ac-logger/compare/v2.0.1..v2.1.0) (2023-07-26 06:39:56)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Feature
|
|
7
|
+
|
|
8
|
+
* **App:** Add option to add more transporters | MP | [1b26ccf1bee9dde56545e51f767f03def84328b7](https://github.com/admiralcloud/ac-logger/commit/1b26ccf1bee9dde56545e51f767f03def84328b7)
|
|
9
|
+
You can init the logger with additional transporters
|
|
10
|
+
Related issues: [/issues#undefined](https://github.com//issues/undefined)
|
|
11
|
+
<a name="2.0.1"></a>
|
|
12
|
+
|
|
13
|
+
## [2.0.1](https://github.com/admiralcloud/ac-logger/compare/v2.0.0..v2.0.1) (2023-07-26 06:22:11)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fix
|
|
17
|
+
|
|
18
|
+
* **App:** Package updates | MP | [0ecf57bd987c030186ad4f5297931b9e0d078f43](https://github.com/admiralcloud/ac-logger/commit/0ecf57bd987c030186ad4f5297931b9e0d078f43)
|
|
19
|
+
Package updates
|
|
20
|
+
Related issues: [/issues#undefined](https://github.com//issues/undefined)
|
|
1
21
|
<a name="2.0.0"></a>
|
|
2
22
|
|
|
3
23
|
# [2.0.0](https://github.com/admiralcloud/ac-logger/compare/v1.3.2..v2.0.0) (2023-03-09 18:18:08)
|
package/index.js
CHANGED
|
@@ -4,14 +4,7 @@ const path = require('path')
|
|
|
4
4
|
|
|
5
5
|
const { createLogger, format, transports, addColors } = require('winston');
|
|
6
6
|
|
|
7
|
-
module.exports = (
|
|
8
|
-
const prefixFields = _.get(config, 'prefixFields', [])
|
|
9
|
-
const timestampFormat = _.get(config, 'timestampFormat', 'YYYY-MM-DD HH:mm:ss')
|
|
10
|
-
const level = _.get(config, 'level', (process.env.NODE_ENV === 'production' ? 'info' : 'verbose'))
|
|
11
|
-
const headLength = _.get(config, 'headLength', 80)
|
|
12
|
-
const padLength = _.get(config, 'padLength', 12)
|
|
13
|
-
const customLevels = _.get(config,'customLevels')
|
|
14
|
-
|
|
7
|
+
module.exports = ({ prefixFields = [], timestampFormat = 'YYYY-MM-DD HH:mm:ss', level = (process.env.NODE_ENV === 'production' ? 'info' : 'verbose'), headLength = 80, padLength = 12, customLevels, additionalTransports } = {}) => {
|
|
15
8
|
const precisionMap = [
|
|
16
9
|
{ precision: 1e6, name: 'ms' },
|
|
17
10
|
{ precision: 1e3, name: 'µs' },
|
|
@@ -64,6 +57,13 @@ module.exports = (config) => {
|
|
|
64
57
|
const acLogger = createLogger(logConfig)
|
|
65
58
|
if (_.get(customLevels, 'colors')) addColors(_.get(customLevels, 'colors'))
|
|
66
59
|
|
|
60
|
+
// Array of objects with type (e.g. File) and options for that type
|
|
61
|
+
if (_.size(additionalTransports)) {
|
|
62
|
+
_.forEach(additionalTransports, transport => {
|
|
63
|
+
acLogger.add(new transports[transport.type](transport.options))
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
67
|
if (process.env.NODE_ENV === 'test') {
|
|
68
68
|
acLogger.add(new transports.File({
|
|
69
69
|
filename: 'test.log',
|
package/package.json
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
"author": "Mark Poepping (https://www.admiralcloud.com)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "admiralcloud/ac-logger",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.1.0",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"lodash": "^4.17.21",
|
|
9
9
|
"moment": "^2.29.4",
|
|
10
|
-
"winston": "^3.
|
|
10
|
+
"winston": "^3.10.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"ac-semantic-release": "^0.
|
|
13
|
+
"ac-semantic-release": "^0.4.2",
|
|
14
14
|
"chai": "^4.3.7",
|
|
15
|
-
"eslint": "^8.
|
|
15
|
+
"eslint": "^8.45.0",
|
|
16
16
|
"intercept-stdout": "^0.1.2",
|
|
17
17
|
"mocha": "^10.2.0",
|
|
18
18
|
"mocha-jenkins-reporter": "^0.4.8"
|