@ui5/logger 3.0.1-beta.0 → 3.0.1-rc.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 +19 -1
- package/jsdoc.json +1 -1
- package/lib/logger.js +33 -67
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,23 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
-
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v3.0.1-
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v3.0.1-rc.0...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.1-rc.0"></a>
|
|
8
|
+
## [v3.0.1-rc.0] - 2022-12-22
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
- Deprecate advanced APIs in preparation of refactoring [`3aea5e7`](https://github.com/SAP/ui5-logger/commit/3aea5e766f9bda156e8c7e62a2e8c65f613ef7e9)
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGE
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<a name="v3.0.1-beta.1"></a>
|
|
18
|
+
## [v3.0.1-beta.1] - 2022-11-11
|
|
19
|
+
### Dependency Updates
|
|
20
|
+
- Bump npmlog from 5.0.1 to 7.0.1 ([#321](https://github.com/SAP/ui5-logger/issues/321)) [`6c5c154`](https://github.com/SAP/ui5-logger/commit/6c5c154c53d8f81774d588714e8426922fa85271)
|
|
21
|
+
|
|
6
22
|
|
|
7
23
|
<a name="v3.0.1-beta.0"></a>
|
|
8
24
|
## [v3.0.1-beta.0] - 2022-11-07
|
|
@@ -117,6 +133,8 @@ Only Node.js v10 or higher is supported.
|
|
|
117
133
|
<a name="v0.0.1"></a>
|
|
118
134
|
## v0.0.1 - 2018-06-06
|
|
119
135
|
|
|
136
|
+
[v3.0.1-rc.0]: https://github.com/SAP/ui5-logger/compare/v3.0.1-beta.1...v3.0.1-rc.0
|
|
137
|
+
[v3.0.1-beta.1]: https://github.com/SAP/ui5-logger/compare/v3.0.1-beta.0...v3.0.1-beta.1
|
|
120
138
|
[v3.0.1-beta.0]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.3...v3.0.1-beta.0
|
|
121
139
|
[v3.0.1-alpha.3]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.2...v3.0.1-alpha.3
|
|
122
140
|
[v3.0.1-alpha.2]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.1...v3.0.1-alpha.2
|
package/jsdoc.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"openGraph": {
|
|
28
28
|
"title": "UI5 Tooling - API Reference",
|
|
29
29
|
"type": "website",
|
|
30
|
-
"image": "https://sap.github.io/ui5-tooling/
|
|
30
|
+
"image": "https://sap.github.io/ui5-tooling/v3/images/UI5_logo_wide.png",
|
|
31
31
|
"site_name": "UI5 Tooling - API Reference",
|
|
32
32
|
"url": "https://sap.github.io/ui5-tooling/"
|
|
33
33
|
},
|
package/lib/logger.js
CHANGED
|
@@ -39,6 +39,20 @@ function isLevelEnabled(levelName) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
const substitutionPlaceholders = /%[oOdisfc]/g;
|
|
43
|
+
function handleLogArguments(mode, messages) {
|
|
44
|
+
if (messages.length > 1) {
|
|
45
|
+
messages[0] = messages[0].replaceAll(substitutionPlaceholders, "<deprecated string substitution char>");
|
|
46
|
+
}
|
|
47
|
+
if (messages.length > 2) {
|
|
48
|
+
console.log(`⚠️ @ui5/logger: Deprecated log.${mode}() call with multiple arguments. ` +
|
|
49
|
+
`@ui5/logger version 3 does not accept more than two argument. Call stack of this invocation:`);
|
|
50
|
+
console.trace();
|
|
51
|
+
return [messages[0], messages[1]];
|
|
52
|
+
}
|
|
53
|
+
return messages;
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
class Logger {
|
|
43
57
|
constructor(moduleName) {
|
|
44
58
|
this._moduleName = moduleName;
|
|
@@ -50,95 +64,48 @@ class Logger {
|
|
|
50
64
|
}
|
|
51
65
|
|
|
52
66
|
silly(...messages) {
|
|
53
|
-
return this._logger.silly(this._moduleName, ...messages);
|
|
67
|
+
return this._logger.silly(this._moduleName, ...handleLogArguments("silly", messages));
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
verbose(...messages) {
|
|
57
|
-
return this._logger.verbose(this._moduleName, ...messages);
|
|
71
|
+
return this._logger.verbose(this._moduleName, ...handleLogArguments("verbose", messages));
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
perf(...messages) {
|
|
61
|
-
return this._logger.perf(this._moduleName, ...messages);
|
|
75
|
+
return this._logger.perf(this._moduleName, ...handleLogArguments("perf", messages));
|
|
62
76
|
}
|
|
63
77
|
|
|
64
78
|
info(...messages) {
|
|
65
|
-
return this._logger.info(this._moduleName, ...messages);
|
|
79
|
+
return this._logger.info(this._moduleName, ...handleLogArguments("info", messages));
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
warn(...messages) {
|
|
69
|
-
return this._logger.warn(this._moduleName, ...messages);
|
|
83
|
+
return this._logger.warn(this._moduleName, ...handleLogArguments("warn", messages));
|
|
70
84
|
}
|
|
71
85
|
|
|
72
86
|
error(...messages) {
|
|
73
|
-
return this._logger.error(this._moduleName, ...messages);
|
|
87
|
+
return this._logger.error(this._moduleName, ...handleLogArguments("error", messages));
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
_getLogger() {
|
|
91
|
+
// TODO 3.0: Remove this function
|
|
92
|
+
console.log("⚠️ Deprecated call to Logger#_getLogger. " +
|
|
93
|
+
"Internal method Logger#_getLogger has been deprecated and will be removed.");
|
|
94
|
+
console.trace();
|
|
77
95
|
return this._logger;
|
|
78
96
|
}
|
|
79
97
|
}
|
|
80
98
|
|
|
81
|
-
class GroupLogger extends Logger {
|
|
82
|
-
constructor(moduleName, weight = 0, parentLogger) {
|
|
83
|
-
super(moduleName);
|
|
84
|
-
|
|
85
|
-
if (parentLogger) {
|
|
86
|
-
this._logger = parentLogger._getLogger().newGroup("", weight);
|
|
87
|
-
} else {
|
|
88
|
-
this._logger = npmlog.newGroup("", weight);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
createSubLogger(name, weight) {
|
|
93
|
-
return new GroupLogger(this._moduleName + " " + name, weight, this);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
createTaskLogger(name, todo, weight) {
|
|
97
|
-
return new TaskLogger(this._moduleName + " " + name, todo, weight, this);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
class TaskLogger extends Logger {
|
|
103
|
-
constructor(moduleName, todo, weight, parentLogger) {
|
|
104
|
-
super(moduleName);
|
|
105
|
-
this._todo = todo || 0;
|
|
106
|
-
this._completed = 0;
|
|
107
|
-
|
|
108
|
-
if (parentLogger) {
|
|
109
|
-
this._logger = parentLogger._getLogger().newItem("", todo, weight);
|
|
110
|
-
} else {
|
|
111
|
-
this._logger = npmlog.newItem(this._moduleName, todo, weight);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
addWork(todo) {
|
|
116
|
-
this._logger.addWork(todo);
|
|
117
|
-
this._todo += todo;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
startWork(...messages) {
|
|
121
|
-
// Current job number is completed + 1
|
|
122
|
-
this.info(`(${this._completed + 1}/${this._todo})`, ...messages);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
completeWork(completed) {
|
|
126
|
-
this._completed += completed;
|
|
127
|
-
this._logger.completeWork(completed);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
finish() {
|
|
131
|
-
return this._logger.finish();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
99
|
const logger = {
|
|
136
100
|
getLogger: function(moduleName) {
|
|
137
101
|
return new Logger(moduleName);
|
|
138
102
|
},
|
|
139
103
|
|
|
140
104
|
getGroupLogger: function(moduleName) {
|
|
141
|
-
|
|
105
|
+
// TODO 3.0: Remove this function
|
|
106
|
+
throw new Error("Deprecated call to @ui5/logger#getGroupLogger. " +
|
|
107
|
+
"This function has been deprecated in @ui5/logger version 3 and will be " +
|
|
108
|
+
"removed in the final release");
|
|
142
109
|
},
|
|
143
110
|
|
|
144
111
|
setLevel(level) {
|
|
@@ -151,11 +118,10 @@ const logger = {
|
|
|
151
118
|
isLevelEnabled,
|
|
152
119
|
|
|
153
120
|
setShowProgress(showProgress) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
121
|
+
// TODO 3.0: Remove this function
|
|
122
|
+
throw new Error("Deprecated call to @ui5/logger#setShowProgress. " +
|
|
123
|
+
"This function has been deprecated in @ui5/logger version 3 and will be " +
|
|
124
|
+
"removed in the final release");
|
|
159
125
|
},
|
|
160
126
|
};
|
|
161
127
|
|
|
@@ -163,7 +129,7 @@ const logger = {
|
|
|
163
129
|
/* istanbul ignore else */
|
|
164
130
|
if (process.env.NODE_ENV === "test") {
|
|
165
131
|
logger.__test__ = {
|
|
166
|
-
Logger
|
|
132
|
+
Logger
|
|
167
133
|
};
|
|
168
134
|
}
|
|
169
135
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/logger",
|
|
3
|
-
"version": "3.0.1-
|
|
3
|
+
"version": "3.0.1-rc.0",
|
|
4
4
|
"description": "UI5 Tooling - Internal Logger",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"./package.json": "./package.json"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
|
-
"node": "
|
|
25
|
+
"node": "^16.18.0 || >=18.0.0",
|
|
26
26
|
"npm": ">= 8"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
@@ -108,25 +108,25 @@
|
|
|
108
108
|
"url": "git@github.com:SAP/ui5-logger.git"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"npmlog": "^
|
|
111
|
+
"npmlog": "^7.0.1"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@istanbuljs/esm-loader-hook": "^0.2.0",
|
|
115
|
-
"ava": "^5.0
|
|
115
|
+
"ava": "^5.1.0",
|
|
116
116
|
"chokidar-cli": "^3.0.0",
|
|
117
117
|
"cross-env": "^7.0.3",
|
|
118
118
|
"depcheck": "^1.4.3",
|
|
119
|
-
"docdash": "^
|
|
120
|
-
"eslint": "^8.
|
|
119
|
+
"docdash": "^2.0.0",
|
|
120
|
+
"eslint": "^8.30.0",
|
|
121
121
|
"eslint-config-google": "^0.14.0",
|
|
122
122
|
"eslint-plugin-ava": "^13.2.0",
|
|
123
|
-
"eslint-plugin-jsdoc": "^39.6.
|
|
124
|
-
"esmock": "^2.0
|
|
125
|
-
"jsdoc": "^3.6.
|
|
123
|
+
"eslint-plugin-jsdoc": "^39.6.4",
|
|
124
|
+
"esmock": "^2.1.0",
|
|
125
|
+
"jsdoc": "^3.6.11",
|
|
126
126
|
"nyc": "^15.1.0",
|
|
127
127
|
"open-cli": "^7.1.0",
|
|
128
128
|
"rimraf": "^3.0.2",
|
|
129
|
-
"sinon": "^
|
|
129
|
+
"sinon": "^15.0.1",
|
|
130
130
|
"tap-nyan": "^1.1.0",
|
|
131
131
|
"tap-xunit": "^2.4.1"
|
|
132
132
|
}
|