@ui5/logger 3.0.1-alpha.1 → 3.0.1-alpha.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 ADDED
@@ -0,0 +1,109 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
+
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.3...HEAD).
6
+
7
+ <a name="v3.0.1-alpha.3"></a>
8
+ ## [v3.0.1-alpha.3] - 2022-10-24
9
+ ### Breaking Changes
10
+ - Transform to native ESM ([#306](https://github.com/SAP/ui5-logger/issues/306)) [`c79608b`](https://github.com/SAP/ui5-logger/commit/c79608b0e432168ca8570530b63a456b9ddd12cb)
11
+
12
+ ### BREAKING CHANGE
13
+
14
+ This package has been transformed to native ESM. Therefore it no longer provides a CommonJS export.
15
+ If your project uses CommonJS, it needs to be converted to ESM or use a dynamic import.
16
+
17
+ For more information see also:
18
+ - https://sap.github.io/ui5-tooling/updates/migrate-v3/
19
+ - https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
20
+
21
+
22
+ <a name="v3.0.1-alpha.2"></a>
23
+ ## [v3.0.1-alpha.2] - 2022-07-28
24
+ ### Features
25
+ - Add new log level "perf" [`acf0c71`](https://github.com/SAP/ui5-logger/commit/acf0c717612f440ea7a114e757c05d358ae523a7)
26
+
27
+
28
+ <a name="v3.0.1-alpha.1"></a>
29
+ ## [v3.0.1-alpha.1] - 2022-01-25
30
+ ### Breaking Changes
31
+ - Require Node.js >= 16.13.2 / npm >= 8 [`a8af8a7`](https://github.com/SAP/ui5-logger/commit/a8af8a7a82c6f657ac10b5018e654939d90fd81f)
32
+
33
+ ### BREAKING CHANGE
34
+
35
+ Support for older Node.js and npm releases has been dropped.
36
+ Only Node.js v16.13.2 and npm v8 or higher are supported.
37
+
38
+
39
+ <a name="v3.0.1-alpha.0"></a>
40
+ ## [v3.0.1-alpha.0] - 2021-12-14
41
+
42
+ <a name="v3.0.0-next.0"></a>
43
+ ## [v3.0.0-next.0] - 2021-11-29
44
+
45
+ <a name="v3.0.0-alpha.0"></a>
46
+ ## [v3.0.0-alpha.0] - 2021-12-14
47
+
48
+ <a name="v2.0.1"></a>
49
+ ## [v2.0.1] - 2020-10-22
50
+ ### Bug Fixes
51
+ - Typos in error messages [`1d25902`](https://github.com/SAP/ui5-logger/commit/1d2590223c4332f5ea6f1326b23ecf584fea5934)
52
+
53
+
54
+ <a name="v2.0.0"></a>
55
+ ## [v2.0.0] - 2020-03-31
56
+ ### Breaking Changes
57
+ - Require Node.js >= 10 [`1825d10`](https://github.com/SAP/ui5-logger/commit/1825d1013a88f164cbbfbf579c3e8e02df2b5082)
58
+
59
+ ### BREAKING CHANGE
60
+
61
+ Support for older Node.js releases has been dropped.
62
+ Only Node.js v10 or higher is supported.
63
+
64
+
65
+ <a name="v1.0.2"></a>
66
+ ## [v1.0.2] - 2019-10-14
67
+ ### Bug Fixes
68
+ - Fix handling of log level "silent" [`020ced8`](https://github.com/SAP/ui5-logger/commit/020ced85a82d33c94e429aa28983affa0d8341ba)
69
+
70
+
71
+ <a name="v1.0.1"></a>
72
+ ## [v1.0.1] - 2019-03-21
73
+
74
+ <a name="v1.0.0"></a>
75
+ ## [v1.0.0] - 2019-01-09
76
+
77
+ <a name="v0.2.2"></a>
78
+ ## [v0.2.2] - 2018-11-16
79
+ ### Features
80
+ - Add UI5_LOG_LVL environment variable [`c3e65c4`](https://github.com/SAP/ui5-logger/commit/c3e65c444045832773e4dc43ffa2baf903a27e52)
81
+
82
+
83
+ <a name="v0.2.1"></a>
84
+ ## [v0.2.1] - 2018-10-29
85
+
86
+ <a name="v0.2.0"></a>
87
+ ## [v0.2.0] - 2018-07-11
88
+
89
+ <a name="v0.1.0"></a>
90
+ ## [v0.1.0] - 2018-06-26
91
+
92
+ <a name="v0.0.1"></a>
93
+ ## v0.0.1 - 2018-06-06
94
+
95
+ [v3.0.1-alpha.3]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.2...v3.0.1-alpha.3
96
+ [v3.0.1-alpha.2]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.1...v3.0.1-alpha.2
97
+ [v3.0.1-alpha.1]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.0...v3.0.1-alpha.1
98
+ [v3.0.1-alpha.0]: https://github.com/SAP/ui5-logger/compare/v3.0.0-next.0...v3.0.1-alpha.0
99
+ [v3.0.0-next.0]: https://github.com/SAP/ui5-logger/compare/v3.0.0-alpha.0...v3.0.0-next.0
100
+ [v3.0.0-alpha.0]: https://github.com/SAP/ui5-logger/compare/v2.0.1...v3.0.0-alpha.0
101
+ [v2.0.1]: https://github.com/SAP/ui5-logger/compare/v2.0.0...v2.0.1
102
+ [v2.0.0]: https://github.com/SAP/ui5-logger/compare/v1.0.2...v2.0.0
103
+ [v1.0.2]: https://github.com/SAP/ui5-logger/compare/v1.0.1...v1.0.2
104
+ [v1.0.1]: https://github.com/SAP/ui5-logger/compare/v1.0.0...v1.0.1
105
+ [v1.0.0]: https://github.com/SAP/ui5-logger/compare/v0.2.2...v1.0.0
106
+ [v0.2.2]: https://github.com/SAP/ui5-logger/compare/v0.2.1...v0.2.2
107
+ [v0.2.1]: https://github.com/SAP/ui5-logger/compare/v0.2.0...v0.2.1
108
+ [v0.2.0]: https://github.com/SAP/ui5-logger/compare/v0.1.0...v0.2.0
109
+ [v0.1.0]: https://github.com/SAP/ui5-logger/compare/v0.0.1...v0.1.0
package/jsdoc.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "allowUnknownTags": false
4
4
  },
5
5
  "source": {
6
- "include": ["README.md", "index.js"],
6
+ "include": ["README.md"],
7
7
  "includePattern": ".+\\.js$",
8
8
  "excludePattern": "(node_modules(\\\\|/))"
9
9
  },
10
10
  "plugins": [
11
- "./jsdoc-plugin"
11
+ "jsdoc-plugin.cjs"
12
12
  ],
13
13
  "opts": {
14
14
  "encoding": "utf8",
package/lib/logger.js CHANGED
@@ -1,6 +1,6 @@
1
- const npmlog = require("npmlog");
1
+ import npmlog from "npmlog";
2
2
 
3
- const levels = ["silly", "verbose", "info", "warn", "error", "silent"];
3
+ const levels = ["silly", "verbose", "perf", "info", "warn", "error", "silent"];
4
4
  if (process.env.UI5_LOG_LVL) {
5
5
  const logLvl = process.env.UI5_LOG_LVL;
6
6
  if (!levels.includes(logLvl)) {
@@ -12,7 +12,12 @@ if (process.env.UI5_LOG_LVL) {
12
12
  npmlog.level = "info"; // Our default
13
13
  }
14
14
 
15
- npmlog.enableUnicode();
15
+ npmlog.enableUnicode(); // TODO: Check whether unicode is actually supported
16
+ npmlog.prefixStyle = {fg: "blue"};
17
+ npmlog.headingStyle = {fg: "white", bg: "black"};
18
+
19
+ // Verbose is at level 1000, info at 2000
20
+ npmlog.addLevel("perf", 1500, {fg: "white", bg: "red"}, "PERF");
16
21
 
17
22
  npmlog.on("error", (err) => {
18
23
  console.log(err);
@@ -52,6 +57,10 @@ class Logger {
52
57
  return this._logger.verbose(this._moduleName, ...messages);
53
58
  }
54
59
 
60
+ perf(...messages) {
61
+ return this._logger.perf(this._moduleName, ...messages);
62
+ }
63
+
55
64
  info(...messages) {
56
65
  return this._logger.info(this._moduleName, ...messages);
57
66
  }
@@ -151,10 +160,11 @@ const logger = {
151
160
  };
152
161
 
153
162
  // Export internal classes for testing only
163
+ /* istanbul ignore else */
154
164
  if (process.env.NODE_ENV === "test") {
155
165
  logger.__test__ = {
156
166
  Logger, GroupLogger, TaskLogger
157
167
  };
158
168
  }
159
169
 
160
- module.exports = logger;
170
+ export default logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/logger",
3
- "version": "3.0.1-alpha.1",
3
+ "version": "3.0.1-alpha.3",
4
4
  "description": "UI5 Tooling - Internal Logger",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -16,7 +16,11 @@
16
16
  "development",
17
17
  "tool"
18
18
  ],
19
- "main": "index.js",
19
+ "type": "module",
20
+ "exports": {
21
+ ".": "./lib/logger.js",
22
+ "./package.json": "./package.json"
23
+ },
20
24
  "engines": {
21
25
  "node": ">= 16.13.2",
22
26
  "npm": ">= 8"
@@ -27,23 +31,23 @@
27
31
  "lint": "eslint ./",
28
32
  "unit": "rimraf test/tmp && ava",
29
33
  "unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial",
30
- "unit-watch": "rimraf test/tmp && ava --watch",
31
- "unit-nyan": "rimraf test/tmp && ava --tap | tnyan",
32
- "unit-xunit": "rimraf test/tmp && ava --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
34
+ "unit-watch": "npm run unit -- --watch",
35
+ "unit-nyan": "npm run unit -- --tap | tnyan",
36
+ "unit-xunit": "rimraf test/tmp && ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\" --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
33
37
  "unit-inspect": "cross-env UI5_LOG_LVL=verbose ava debug --break",
34
- "coverage": "nyc npm run unit",
38
+ "coverage": "rimraf test/tmp && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
35
39
  "coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
36
40
  "jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
37
41
  "jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
38
42
  "jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
39
43
  "preversion": "npm test",
40
- "version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
44
+ "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
41
45
  "postversion": "git push --follow-tags",
42
- "release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
43
- "depcheck": "depcheck --ignores docdash"
46
+ "release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
47
+ "depcheck": "depcheck --ignores docdash,@istanbuljs/esm-loader-hook"
44
48
  },
45
49
  "files": [
46
- "index.js",
50
+ "CHANGELOG.md",
47
51
  "CONTRIBUTING.md",
48
52
  "jsdoc.json",
49
53
  "lib/**",
@@ -53,6 +57,10 @@
53
57
  "ava": {
54
58
  "files": [
55
59
  "test/lib/**/*.js"
60
+ ],
61
+ "nodeArguments": [
62
+ "--loader=esmock",
63
+ "--no-warnings"
56
64
  ]
57
65
  },
58
66
  "nyc": {
@@ -66,8 +74,8 @@
66
74
  "jsdocs/**",
67
75
  "coverage/**",
68
76
  "test/**",
69
- ".eslintrc.js",
70
- "jsdoc-plugin.js"
77
+ ".eslintrc.cjs",
78
+ "jsdoc-plugin.cjs"
71
79
  ],
72
80
  "check-coverage": true,
73
81
  "statements": 90,
@@ -100,10 +108,11 @@
100
108
  "url": "git@github.com:SAP/ui5-logger.git"
101
109
  },
102
110
  "dependencies": {
103
- "npmlog": "^5.0.1"
111
+ "npmlog": "^6.0.2"
104
112
  },
105
113
  "devDependencies": {
106
- "ava": "^3.15.0",
114
+ "@istanbuljs/esm-loader-hook": "^0.2.0",
115
+ "ava": "^4.3.1",
107
116
  "chokidar-cli": "^3.0.0",
108
117
  "cross-env": "^7.0.3",
109
118
  "depcheck": "^1.4.3",
@@ -112,12 +121,12 @@
112
121
  "eslint-config-google": "^0.14.0",
113
122
  "eslint-plugin-ava": "^13.2.0",
114
123
  "eslint-plugin-jsdoc": "^37.6.3",
124
+ "esmock": "^1.8.9",
115
125
  "jsdoc": "^3.6.7",
116
- "mock-require": "^3.0.3",
117
126
  "nyc": "^15.1.0",
118
127
  "open-cli": "^6.0.1",
119
128
  "rimraf": "^3.0.2",
120
- "sinon": "^11.1.2",
129
+ "sinon": "^14.0.0",
121
130
  "tap-nyan": "^1.1.0",
122
131
  "tap-xunit": "^2.4.1"
123
132
  }
package/index.js DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * @module @ui5/logger
3
- * @private
4
- */
5
- module.exports = require("./lib/logger");