From: Arkadiusz Pietraszek Date: Tue, 15 Jan 2019 11:26:38 +0000 (+0100) Subject: [Common][Utils] Adding functions to unify deprecation warnings. X-Git-Tag: submit/tizen/20190116.121828~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a3e4ee8616a1dbda6e180a7fea37a789e8a01f2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Common][Utils] Adding functions to unify deprecation warnings. [Verification] Code compiles successfully. Change-Id: Id81aa801f3858ead071ef8899cb9cfc4136ad589 Signed-off-by: Arkadiusz Pietraszek --- diff --git a/src/common/tools.cc b/src/common/tools.cc index fd4a2f30..9e0466c1 100644 --- a/src/common/tools.cc +++ b/src/common/tools.cc @@ -579,5 +579,16 @@ PlatformResult CheckFileAvailability(const std::string& path) { return CheckFileStatus(path); } +void PrintDeprecationWarningFor(const char* className, const char* replacement) { + if (nullptr == replacement) { + LoggerW("DEPRECATION WARNING: %s is deprecated and using it is not recommended.", + className); + } else { + LoggerW("DEPRECATION WARNING: %s is deprecated and using it is not recommended. Try using %s instead", + className, replacement); + } + +} + } // namespace tools } // namespace common diff --git a/src/common/tools.h b/src/common/tools.h index 88136c48..73acde6b 100644 --- a/src/common/tools.h +++ b/src/common/tools.h @@ -117,6 +117,8 @@ PlatformResult CheckFileStatus(const std::string& path); PlatformResult CheckFileAvailability(const std::string& path); +void PrintDeprecationWarningFor(const char* className, const char* replacement = nullptr); + } // namespace tools } // namespace common diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 90f7a5c8..5eb3f65e 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -293,6 +293,15 @@ Utils.prototype.checkProfile = function() { return native_.getResultObject(result); }; +Utils.prototype.printDeprecationWarningFor = function(name, replacement) { + if (_type.isUndefined(replacement)) { + this.warn('DEPRECATION WARNING: ' + name + ' is deprecated and using it is not recommended.'); + } else { + this.warn('DEPRECATION WARNING: ' + name + ' is deprecated and using it is not recommended.' + + "Try using " + replacement + " instead."); + } +}; + ///////////////////////////////////////////////////////////////////////////// /** @constructor */