@ui5/logger
Advanced tools
Comparing version 3.0.1-beta.1 to 3.0.1-rc.0
@@ -5,6 +5,16 @@ # Changelog | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v3.0.1-beta.1...HEAD). | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v3.0.1-rc.0...HEAD). | ||
<a name="v3.0.1-rc.0"></a> | ||
## [v3.0.1-rc.0] - 2022-12-22 | ||
### Breaking Changes | ||
- Deprecate advanced APIs in preparation of refactoring [`3aea5e7`](https://github.com/SAP/ui5-logger/commit/3aea5e766f9bda156e8c7e62a2e8c65f613ef7e9) | ||
### BREAKING CHANGE | ||
<a name="v3.0.1-beta.1"></a> | ||
## [v3.0.1-beta.1] - 2022-11-09 | ||
## [v3.0.1-beta.1] - 2022-11-11 | ||
### Dependency Updates | ||
@@ -127,2 +137,3 @@ - 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) | ||
[v3.0.1-rc.0]: https://github.com/SAP/ui5-logger/compare/v3.0.1-beta.1...v3.0.1-rc.0 | ||
[v3.0.1-beta.1]: https://github.com/SAP/ui5-logger/compare/v3.0.1-beta.0...v3.0.1-beta.1 | ||
@@ -129,0 +140,0 @@ [v3.0.1-beta.0]: https://github.com/SAP/ui5-logger/compare/v3.0.1-alpha.3...v3.0.1-beta.0 |
@@ -30,3 +30,3 @@ { | ||
"type": "website", | ||
"image": "https://sap.github.io/ui5-tooling/docs/images/UI5_logo_wide.png", | ||
"image": "https://sap.github.io/ui5-tooling/v3/images/UI5_logo_wide.png", | ||
"site_name": "UI5 Tooling - API Reference", | ||
@@ -33,0 +33,0 @@ "url": "https://sap.github.io/ui5-tooling/" |
@@ -42,2 +42,16 @@ import npmlog from "npmlog"; | ||
const substitutionPlaceholders = /%[oOdisfc]/g; | ||
function handleLogArguments(mode, messages) { | ||
if (messages.length > 1) { | ||
messages[0] = messages[0].replaceAll(substitutionPlaceholders, "<deprecated string substitution char>"); | ||
} | ||
if (messages.length > 2) { | ||
console.log(`⚠️ @ui5/logger: Deprecated log.${mode}() call with multiple arguments. ` + | ||
`@ui5/logger version 3 does not accept more than two argument. Call stack of this invocation:`); | ||
console.trace(); | ||
return [messages[0], messages[1]]; | ||
} | ||
return messages; | ||
} | ||
class Logger { | ||
@@ -54,26 +68,30 @@ constructor(moduleName) { | ||
silly(...messages) { | ||
return this._logger.silly(this._moduleName, ...messages); | ||
return this._logger.silly(this._moduleName, ...handleLogArguments("silly", messages)); | ||
} | ||
verbose(...messages) { | ||
return this._logger.verbose(this._moduleName, ...messages); | ||
return this._logger.verbose(this._moduleName, ...handleLogArguments("verbose", messages)); | ||
} | ||
perf(...messages) { | ||
return this._logger.perf(this._moduleName, ...messages); | ||
return this._logger.perf(this._moduleName, ...handleLogArguments("perf", messages)); | ||
} | ||
info(...messages) { | ||
return this._logger.info(this._moduleName, ...messages); | ||
return this._logger.info(this._moduleName, ...handleLogArguments("info", messages)); | ||
} | ||
warn(...messages) { | ||
return this._logger.warn(this._moduleName, ...messages); | ||
return this._logger.warn(this._moduleName, ...handleLogArguments("warn", messages)); | ||
} | ||
error(...messages) { | ||
return this._logger.error(this._moduleName, ...messages); | ||
return this._logger.error(this._moduleName, ...handleLogArguments("error", messages)); | ||
} | ||
_getLogger() { | ||
// TODO 3.0: Remove this function | ||
console.log("⚠️ Deprecated call to Logger#_getLogger. " + | ||
"Internal method Logger#_getLogger has been deprecated and will be removed."); | ||
console.trace(); | ||
return this._logger; | ||
@@ -83,56 +101,2 @@ } | ||
class GroupLogger extends Logger { | ||
constructor(moduleName, weight = 0, parentLogger) { | ||
super(moduleName); | ||
if (parentLogger) { | ||
this._logger = parentLogger._getLogger().newGroup("", weight); | ||
} else { | ||
this._logger = npmlog.newGroup("", weight); | ||
} | ||
} | ||
createSubLogger(name, weight) { | ||
return new GroupLogger(this._moduleName + " " + name, weight, this); | ||
} | ||
createTaskLogger(name, todo, weight) { | ||
return new TaskLogger(this._moduleName + " " + name, todo, weight, this); | ||
} | ||
} | ||
class TaskLogger extends Logger { | ||
constructor(moduleName, todo, weight, parentLogger) { | ||
super(moduleName); | ||
this._todo = todo || 0; | ||
this._completed = 0; | ||
if (parentLogger) { | ||
this._logger = parentLogger._getLogger().newItem("", todo, weight); | ||
} else { | ||
this._logger = npmlog.newItem(this._moduleName, todo, weight); | ||
} | ||
} | ||
addWork(todo) { | ||
this._logger.addWork(todo); | ||
this._todo += todo; | ||
} | ||
startWork(...messages) { | ||
// Current job number is completed + 1 | ||
this.info(`(${this._completed + 1}/${this._todo})`, ...messages); | ||
} | ||
completeWork(completed) { | ||
this._completed += completed; | ||
this._logger.completeWork(completed); | ||
} | ||
finish() { | ||
return this._logger.finish(); | ||
} | ||
} | ||
const logger = { | ||
@@ -144,3 +108,6 @@ getLogger: function(moduleName) { | ||
getGroupLogger: function(moduleName) { | ||
return new GroupLogger(moduleName); | ||
// TODO 3.0: Remove this function | ||
throw new Error("Deprecated call to @ui5/logger#getGroupLogger. " + | ||
"This function has been deprecated in @ui5/logger version 3 and will be " + | ||
"removed in the final release"); | ||
}, | ||
@@ -158,7 +125,6 @@ | ||
setShowProgress(showProgress) { | ||
if (showProgress) { | ||
npmlog.enableProgress(); | ||
} else { | ||
npmlog.disableProgress(); | ||
} | ||
// TODO 3.0: Remove this function | ||
throw new Error("Deprecated call to @ui5/logger#setShowProgress. " + | ||
"This function has been deprecated in @ui5/logger version 3 and will be " + | ||
"removed in the final release"); | ||
}, | ||
@@ -171,3 +137,3 @@ }; | ||
logger.__test__ = { | ||
Logger, GroupLogger, TaskLogger | ||
Logger | ||
}; | ||
@@ -174,0 +140,0 @@ } |
{ | ||
"name": "@ui5/logger", | ||
"version": "3.0.1-beta.1", | ||
"version": "3.0.1-rc.0", | ||
"description": "UI5 Tooling - Internal Logger", | ||
@@ -115,12 +115,12 @@ "author": { | ||
"@istanbuljs/esm-loader-hook": "^0.2.0", | ||
"ava": "^5.0.1", | ||
"ava": "^5.1.0", | ||
"chokidar-cli": "^3.0.0", | ||
"cross-env": "^7.0.3", | ||
"depcheck": "^1.4.3", | ||
"docdash": "^1.2.0", | ||
"eslint": "^8.27.0", | ||
"docdash": "^2.0.0", | ||
"eslint": "^8.30.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-plugin-ava": "^13.2.0", | ||
"eslint-plugin-jsdoc": "^39.6.2", | ||
"esmock": "^2.0.7", | ||
"eslint-plugin-jsdoc": "^39.6.4", | ||
"esmock": "^2.1.0", | ||
"jsdoc": "^3.6.11", | ||
@@ -130,3 +130,3 @@ "nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"sinon": "^14.0.2", | ||
"sinon": "^15.0.1", | ||
"tap-nyan": "^1.1.0", | ||
@@ -133,0 +133,0 @@ "tap-xunit": "^2.4.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39557
175