@ui5/webcomponents-core
Advanced tools
Comparing version 0.0.0-04e3a6f74 to 0.0.0-07460127d
@@ -13,3 +13,3 @@ import now from './util/now.js'; | ||
}; | ||
var sDefaultComponent, aLog = [], mMaxLevel = { '': Log.Level.ERROR }, oListener = null, bLogSupportInfo = false; | ||
var sDefaultComponent, aLog = [], mMaxLevel = { '': Log.Level.ERROR }, iLogEntriesLimit = 3000, oListener = null, bLogSupportInfo = false; | ||
function pad0(i, w) { | ||
@@ -21,2 +21,16 @@ return ('000' + String(i)).slice(-w); | ||
} | ||
function discardLogEntries() { | ||
var iLogLength = aLog.length; | ||
if (iLogLength) { | ||
var iEntriesToKeep = Math.min(iLogLength, Math.floor(iLogEntriesLimit * 0.7)); | ||
if (oListener) { | ||
oListener.onDiscardLogEntries(aLog.slice(0, iLogLength - iEntriesToKeep)); | ||
} | ||
if (iEntriesToKeep) { | ||
aLog = aLog.slice(-iEntriesToKeep, iLogLength); | ||
} else { | ||
aLog = []; | ||
} | ||
} | ||
} | ||
function getLogEntryListenerInstance() { | ||
@@ -33,2 +47,9 @@ if (!oListener) { | ||
}, | ||
onDiscardLogEntries: function (aDiscardedLogEntries) { | ||
for (var i = 0; i < oListener.listeners.length; i++) { | ||
if (oListener.listeners[i].onDiscardLogEntries) { | ||
oListener.listeners[i].onDiscardLogEntries(aDiscardedLogEntries); | ||
} | ||
} | ||
}, | ||
attach: function (oLog, oLstnr) { | ||
@@ -98,12 +119,10 @@ if (oLstnr) { | ||
function log(iLevel, sMessage, sDetails, sComponent, fnSupportInfo) { | ||
if (bLogSupportInfo) { | ||
if (!fnSupportInfo && !sComponent && typeof sDetails === 'function') { | ||
fnSupportInfo = sDetails; | ||
sDetails = ''; | ||
} | ||
if (!fnSupportInfo && typeof sComponent === 'function') { | ||
fnSupportInfo = sComponent; | ||
sComponent = ''; | ||
} | ||
if (!fnSupportInfo && !sComponent && typeof sDetails === 'function') { | ||
fnSupportInfo = sDetails; | ||
sDetails = ''; | ||
} | ||
if (!fnSupportInfo && typeof sComponent === 'function') { | ||
fnSupportInfo = sComponent; | ||
sComponent = ''; | ||
} | ||
sComponent = sComponent || sDefaultComponent; | ||
@@ -123,3 +142,8 @@ if (iLevel <= level(sComponent)) { | ||
} | ||
aLog.push(oLogEntry); | ||
if (iLogEntriesLimit) { | ||
if (aLog.length >= iLogEntriesLimit) { | ||
discardLogEntries(); | ||
} | ||
aLog.push(oLogEntry); | ||
} | ||
if (oListener) { | ||
@@ -129,19 +153,31 @@ oListener.onLogEntry(oLogEntry); | ||
if (console) { | ||
var logText = oLogEntry.date + ' ' + oLogEntry.time + ' ' + oLogEntry.message + ' - ' + oLogEntry.details + ' ' + oLogEntry.component; | ||
var isDetailsError = sDetails instanceof Error, logText = oLogEntry.date + ' ' + oLogEntry.time + ' ' + oLogEntry.message + ' - ' + oLogEntry.details + ' ' + oLogEntry.component; | ||
switch (iLevel) { | ||
case Log.Level.FATAL: | ||
case Log.Level.ERROR: | ||
console.error(logText); | ||
isDetailsError ? console.error(logText, '\n', sDetails) : console.error(logText); | ||
break; | ||
case Log.Level.WARNING: | ||
console.warn(logText); | ||
isDetailsError ? console.warn(logText, '\n', sDetails) : console.warn(logText); | ||
break; | ||
case Log.Level.INFO: | ||
console.info ? console.info(logText) : console.log(logText); | ||
if (console.info) { | ||
isDetailsError ? console.info(logText, '\n', sDetails) : console.info(logText); | ||
} else { | ||
isDetailsError ? console.log(logText, '\n', sDetails) : console.log(logText); | ||
} | ||
break; | ||
case Log.Level.DEBUG: | ||
console.debug ? console.debug(logText) : console.log(logText); | ||
if (console.debug) { | ||
isDetailsError ? console.debug(logText, '\n', sDetails) : console.debug(logText); | ||
} else { | ||
isDetailsError ? console.log(logText, '\n', sDetails) : console.log(logText); | ||
} | ||
break; | ||
case Log.Level.TRACE: | ||
console.trace ? console.trace(logText) : console.log(logText); | ||
if (console.trace) { | ||
isDetailsError ? console.trace(logText, '\n', sDetails) : console.trace(logText); | ||
} else { | ||
isDetailsError ? console.log(logText, '\n', sDetails) : console.log(logText); | ||
} | ||
break; | ||
@@ -159,2 +195,14 @@ } | ||
}; | ||
Log.getLogEntriesLimit = function () { | ||
return iLogEntriesLimit; | ||
}; | ||
Log.setLogEntriesLimit = function (iLimit) { | ||
if (iLimit < 0) { | ||
throw new Error('The log entries limit needs to be greater than or equal to 0!'); | ||
} | ||
iLogEntriesLimit = iLimit; | ||
if (aLog.length >= iLogEntriesLimit) { | ||
discardLogEntries(); | ||
} | ||
}; | ||
Log.addLogListener = function (oListener) { | ||
@@ -161,0 +209,0 @@ getLogEntryListenerInstance().attach(this, oListener); |
@@ -15,3 +15,3 @@ import assert from '../assert.js'; | ||
} else if ($3) { | ||
return String(aValues[parseInt($3, 10)]); | ||
return String(aValues[parseInt($3)]); | ||
} | ||
@@ -18,0 +18,0 @@ throw new Error('formatMessage: pattern syntax error at pos. ' + offset); |
@@ -109,3 +109,3 @@ import BaseObject from '../base/Object.js'; | ||
Locale._cldrLocales = getDesigntimePropertyAsArray('$cldr-locales:ar,ar_EG,ar_SA,bg,br,ca,cs,da,de,de_AT,de_CH,el,el_CY,en,en_AU,en_GB,en_HK,en_IE,en_IN,en_NZ,en_PG,en_SG,en_ZA,es,es_AR,es_BO,es_CL,es_CO,es_MX,es_PE,es_UY,es_VE,et,fa,fi,fr,fr_BE,fr_CA,fr_CH,fr_LU,he,hi,hr,hu,id,it,it_CH,ja,kk,ko,lt,lv,ms,nb,nl,nl_BE,nn,pl,pt,pt_PT,ro,ru,ru_UA,sk,sl,sr,sv,th,tr,uk,vi,zh_CN,zh_HK,zh_SG,zh_TW$'); | ||
Locale._coreI18nLocales = getDesigntimePropertyAsArray('$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,ko,lt,lv,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$'); | ||
Locale._coreI18nLocales = getDesigntimePropertyAsArray('$core-i18n-locales:,ar,bg,ca,cs,da,de,el,en,es,et,fi,fr,hi,hr,hu,it,iw,ja,kk,ko,lt,lv,ms,nl,no,pl,pt,ro,ru,sh,sk,sl,sv,th,tr,uk,vi,zh_CN,zh_TW$'); | ||
Locale._impliesRTL = function (vLanguage) { | ||
@@ -112,0 +112,0 @@ var oLocale = vLanguage instanceof Locale ? vLanguage : new Locale(vLanguage); |
{ | ||
"name": "@ui5/webcomponents-core", | ||
"version": "0.0.0-04e3a6f74", | ||
"version": "0.0.0-07460127d", | ||
"description": "UI5 Web Components: webcomponents.core", | ||
@@ -36,3 +36,3 @@ "author": "SAP SE (https://www.sap.com)", | ||
"@buxlabs/amd-to-es6": "^0.15.0", | ||
"@openui5/sap.ui.core": "1.60.2", | ||
"@openui5/sap.ui.core": "1.75.0", | ||
"copy-and-watch": "^0.1.4", | ||
@@ -39,0 +39,0 @@ "escodegen": "^1.11.0", |
@@ -26,2 +26,2 @@ sap/base/Log.js | ||
sap/ui/thirdparty/jquery.js | ||
sap/ui/thirdparty/es6-string-methods.js | ||
sap/ui/thirdparty/es6-string-methods.js |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
8512321
370783
105