@ui5/webcomponents-base 2.0.0-rc.3 → 2.0.0-rc.4
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 +24 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/Boot.js +1 -1
- package/dist/Boot.js.map +1 -1
- package/dist/Keys.d.ts +2 -1
- package/dist/Keys.js +2 -1
- package/dist/Keys.js.map +1 -1
- package/dist/UI5Element.d.ts +9 -1
- package/dist/UI5Element.js +73 -12
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +5 -0
- package/dist/UI5ElementMetadata.js +6 -0
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/config/AnimationMode.js +2 -1
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/custom-elements-internal.json +6 -15
- package/dist/custom-elements.json +6 -15
- package/dist/decorators/customElement.d.ts +1 -0
- package/dist/decorators/customElement.js +5 -2
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/features/InputElementsFormSupport.d.ts +18 -0
- package/dist/features/InputElementsFormSupport.js +40 -0
- package/dist/features/InputElementsFormSupport.js.map +1 -0
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/AssetRegistry.js +2 -0
- package/dist/prod/AssetRegistry.js.map +7 -0
- package/dist/prod/Boot.js +2 -0
- package/dist/prod/Boot.js.map +7 -0
- package/dist/prod/CustomElementsRegistry.js +10 -0
- package/dist/prod/CustomElementsRegistry.js.map +7 -0
- package/dist/prod/CustomElementsScope.js +2 -0
- package/dist/prod/CustomElementsScope.js.map +7 -0
- package/dist/prod/CustomElementsScopeUtils.js +2 -0
- package/dist/prod/CustomElementsScopeUtils.js.map +7 -0
- package/dist/prod/DOMObserver.js +2 -0
- package/dist/prod/DOMObserver.js.map +7 -0
- package/dist/prod/Device.js +2 -0
- package/dist/prod/Device.js.map +7 -0
- package/dist/prod/EventProvider.js +2 -0
- package/dist/prod/EventProvider.js.map +7 -0
- package/dist/prod/FeaturesRegistry.js +2 -0
- package/dist/prod/FeaturesRegistry.js.map +7 -0
- package/dist/prod/FontFace.js +2 -0
- package/dist/prod/FontFace.js.map +7 -0
- package/dist/prod/IgnoreCustomElements.js +2 -0
- package/dist/prod/IgnoreCustomElements.js.map +7 -0
- package/dist/prod/InitialConfiguration.js +2 -0
- package/dist/prod/InitialConfiguration.js.map +7 -0
- package/dist/prod/Keys.js +2 -0
- package/dist/prod/Keys.js.map +7 -0
- package/dist/prod/ManagedStyles.js +2 -0
- package/dist/prod/ManagedStyles.js.map +7 -0
- package/dist/prod/MarkedEvents.js +2 -0
- package/dist/prod/MarkedEvents.js.map +7 -0
- package/dist/prod/MediaRange.js +2 -0
- package/dist/prod/MediaRange.js.map +7 -0
- package/dist/prod/PropertiesFileFormat.js +3 -0
- package/dist/prod/PropertiesFileFormat.js.map +7 -0
- package/dist/prod/Render.js +2 -0
- package/dist/prod/Render.js.map +7 -0
- package/dist/prod/RenderQueue.js +2 -0
- package/dist/prod/RenderQueue.js.map +7 -0
- package/dist/prod/Runtimes.js +2 -0
- package/dist/prod/Runtimes.js.map +7 -0
- package/dist/prod/SystemCSSVars.js +2 -0
- package/dist/prod/SystemCSSVars.js.map +7 -0
- package/dist/prod/Theming.js +2 -0
- package/dist/prod/Theming.js.map +7 -0
- package/dist/prod/UI5Element.js +2 -0
- package/dist/prod/UI5Element.js.map +7 -0
- package/dist/prod/UI5ElementMetadata.js +2 -0
- package/dist/prod/UI5ElementMetadata.js.map +7 -0
- package/dist/prod/animations/AnimationQueue.js +2 -0
- package/dist/prod/animations/AnimationQueue.js.map +7 -0
- package/dist/prod/animations/animate.js +2 -0
- package/dist/prod/animations/animate.js.map +7 -0
- package/dist/prod/animations/scroll.js +2 -0
- package/dist/prod/animations/scroll.js.map +7 -0
- package/dist/prod/animations/slideDown.js +2 -0
- package/dist/prod/animations/slideDown.js.map +7 -0
- package/dist/prod/animations/slideUp.js +2 -0
- package/dist/prod/animations/slideUp.js.map +7 -0
- package/dist/prod/asset-registries/Icons.js +2 -0
- package/dist/prod/asset-registries/Icons.js.map +7 -0
- package/dist/prod/asset-registries/Illustrations.js +2 -0
- package/dist/prod/asset-registries/Illustrations.js.map +7 -0
- package/dist/prod/asset-registries/LocaleData.js +2 -0
- package/dist/prod/asset-registries/LocaleData.js.map +7 -0
- package/dist/prod/asset-registries/Themes.js +2 -0
- package/dist/prod/asset-registries/Themes.js.map +7 -0
- package/dist/prod/asset-registries/i18n.js +2 -0
- package/dist/prod/asset-registries/i18n.js.map +7 -0
- package/dist/prod/asset-registries/util/IconCollectionsAlias.js +2 -0
- package/dist/prod/asset-registries/util/IconCollectionsAlias.js.map +7 -0
- package/dist/prod/asset-registries/util/IconCollectionsByTheme.js +2 -0
- package/dist/prod/asset-registries/util/IconCollectionsByTheme.js.map +7 -0
- package/dist/prod/asset-registries/util/getIconCollectionByTheme.js +2 -0
- package/dist/prod/asset-registries/util/getIconCollectionByTheme.js.map +7 -0
- package/dist/prod/config/AnimationMode.js +2 -0
- package/dist/prod/config/AnimationMode.js.map +7 -0
- package/dist/prod/config/CalendarType.js +2 -0
- package/dist/prod/config/CalendarType.js.map +7 -0
- package/dist/prod/config/FormatSettings.js +2 -0
- package/dist/prod/config/FormatSettings.js.map +7 -0
- package/dist/prod/config/Icons.js +2 -0
- package/dist/prod/config/Icons.js.map +7 -0
- package/dist/prod/config/Language.js +2 -0
- package/dist/prod/config/Language.js.map +7 -0
- package/dist/prod/config/NoConflict.js +2 -0
- package/dist/prod/config/NoConflict.js.map +7 -0
- package/dist/prod/config/Theme.js +2 -0
- package/dist/prod/config/Theme.js.map +7 -0
- package/dist/prod/config/ThemeRoot.js +2 -0
- package/dist/prod/config/ThemeRoot.js.map +7 -0
- package/dist/prod/config/Timezone.js +2 -0
- package/dist/prod/config/Timezone.js.map +7 -0
- package/dist/prod/connectToComponent.js +2 -0
- package/dist/prod/connectToComponent.js.map +7 -0
- package/dist/prod/decorators/customElement.js +2 -0
- package/dist/prod/decorators/customElement.js.map +7 -0
- package/dist/prod/decorators/event.js +2 -0
- package/dist/prod/decorators/event.js.map +7 -0
- package/dist/prod/decorators/property.js +2 -0
- package/dist/prod/decorators/property.js.map +7 -0
- package/dist/prod/decorators/slot.js +2 -0
- package/dist/prod/decorators/slot.js.map +7 -0
- package/dist/prod/decorators.js +2 -0
- package/dist/prod/decorators.js.map +7 -0
- package/dist/prod/delegate/ItemNavigation.js +2 -0
- package/dist/prod/delegate/ItemNavigation.js.map +7 -0
- package/dist/prod/delegate/ResizeHandler.js +2 -0
- package/dist/prod/delegate/ResizeHandler.js.map +7 -0
- package/dist/prod/delegate/ScrollEnablement.js +2 -0
- package/dist/prod/delegate/ScrollEnablement.js.map +7 -0
- package/dist/prod/features/F6Navigation.js +2 -0
- package/dist/prod/features/F6Navigation.js.map +7 -0
- package/dist/prod/features/InputElementsFormSupport.js +2 -0
- package/dist/prod/features/InputElementsFormSupport.js.map +7 -0
- package/dist/prod/features/LegacyDateFormats.js +2 -0
- package/dist/prod/features/LegacyDateFormats.js.map +7 -0
- package/dist/prod/features/OpenUI5Element.js +2 -0
- package/dist/prod/features/OpenUI5Element.js.map +7 -0
- package/dist/prod/features/OpenUI5Enablement.js +21 -0
- package/dist/prod/features/OpenUI5Enablement.js.map +7 -0
- package/dist/prod/features/OpenUI5Support.js +2 -0
- package/dist/prod/features/OpenUI5Support.js.map +7 -0
- package/dist/prod/features/patchPatcher.js +2 -0
- package/dist/prod/features/patchPatcher.js.map +7 -0
- package/dist/prod/features/patchPopup.js +2 -0
- package/dist/prod/features/patchPopup.js.map +7 -0
- package/dist/prod/generated/AssetParameters.js +2 -0
- package/dist/prod/generated/AssetParameters.js.map +7 -0
- package/dist/prod/generated/VersionInfo.js +2 -0
- package/dist/prod/generated/VersionInfo.js.map +7 -0
- package/dist/prod/generated/css/BusyIndicator.css.js +2 -0
- package/dist/prod/generated/css/BusyIndicator.css.js.map +7 -0
- package/dist/prod/generated/css/FontFace.css.js +2 -0
- package/dist/prod/generated/css/FontFace.css.js.map +7 -0
- package/dist/prod/generated/css/OverrideFontFace.css.js +2 -0
- package/dist/prod/generated/css/OverrideFontFace.css.js.map +7 -0
- package/dist/prod/generated/css/SystemCSSVars.css.js +2 -0
- package/dist/prod/generated/css/SystemCSSVars.css.js.map +7 -0
- package/dist/prod/generated/templates/elements/WithComplexTemplateTemplate.lit.js +2 -0
- package/dist/prod/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +7 -0
- package/dist/prod/getSharedResource.js +2 -0
- package/dist/prod/getSharedResource.js.map +7 -0
- package/dist/prod/global.d.js +2 -0
- package/dist/prod/global.d.js.map +7 -0
- package/dist/prod/i18nBundle.js +2 -0
- package/dist/prod/i18nBundle.js.map +7 -0
- package/dist/prod/locale/Locale.js +2 -0
- package/dist/prod/locale/Locale.js.map +7 -0
- package/dist/prod/locale/RTLAwareRegistry.js +2 -0
- package/dist/prod/locale/RTLAwareRegistry.js.map +7 -0
- package/dist/prod/locale/applyDirection.js +2 -0
- package/dist/prod/locale/applyDirection.js.map +7 -0
- package/dist/prod/locale/directionChange.js +2 -0
- package/dist/prod/locale/directionChange.js.map +7 -0
- package/dist/prod/locale/getEffectiveDir.js +2 -0
- package/dist/prod/locale/getEffectiveDir.js.map +7 -0
- package/dist/prod/locale/getLocale.js +2 -0
- package/dist/prod/locale/getLocale.js.map +7 -0
- package/dist/prod/locale/languageChange.js +2 -0
- package/dist/prod/locale/languageChange.js.map +7 -0
- package/dist/prod/locale/nextFallbackLocale.js +2 -0
- package/dist/prod/locale/nextFallbackLocale.js.map +7 -0
- package/dist/prod/locale/normalizeLocale.js +2 -0
- package/dist/prod/locale/normalizeLocale.js.map +7 -0
- package/dist/prod/renderer/LitRenderer.js +2 -0
- package/dist/prod/renderer/LitRenderer.js.map +7 -0
- package/dist/prod/renderer/directives/style-map.js +6 -0
- package/dist/prod/renderer/directives/style-map.js.map +7 -0
- package/dist/prod/renderer/executeTemplate.js +2 -0
- package/dist/prod/renderer/executeTemplate.js.map +7 -0
- package/dist/prod/sap/base/Log.js +750 -0
- package/dist/prod/sap/base/assert.js +34 -0
- package/dist/prod/sap/base/config/MemoryConfigurationProvider.js +20 -0
- package/dist/prod/sap/base/security/URLListValidator.js +406 -0
- package/dist/prod/sap/base/security/encodeCSS.js +40 -0
- package/dist/prod/sap/base/security/encodeXML.js +53 -0
- package/dist/prod/sap/base/security/sanitizeHTML.js +38 -0
- package/dist/prod/sap/base/strings/toHex.js +33 -0
- package/dist/prod/sap/base/util/now.js +28 -0
- package/dist/prod/sap/base/util/uid.js +27 -0
- package/dist/prod/sap/ui/thirdparty/caja-html-sanitizer.js +3600 -0
- package/dist/prod/ssr-dom-shim.js +2 -0
- package/dist/prod/ssr-dom-shim.js.map +7 -0
- package/dist/prod/ssr-dom.js +2 -0
- package/dist/prod/ssr-dom.js.map +7 -0
- package/dist/prod/theming/CustomStyle.js +2 -0
- package/dist/prod/theming/CustomStyle.js.map +7 -0
- package/dist/prod/theming/ThemeLoaded.js +2 -0
- package/dist/prod/theming/ThemeLoaded.js.map +7 -0
- package/dist/prod/theming/ThemeRegistered.js +2 -0
- package/dist/prod/theming/ThemeRegistered.js.map +7 -0
- package/dist/prod/theming/applyTheme.js +2 -0
- package/dist/prod/theming/applyTheme.js.map +7 -0
- package/dist/prod/theming/getConstructableStyle.js +2 -0
- package/dist/prod/theming/getConstructableStyle.js.map +7 -0
- package/dist/prod/theming/getEffectiveStyle.js +2 -0
- package/dist/prod/theming/getEffectiveStyle.js.map +7 -0
- package/dist/prod/theming/getStylesString.js +2 -0
- package/dist/prod/theming/getStylesString.js.map +7 -0
- package/dist/prod/theming/getThemeDesignerTheme.js +2 -0
- package/dist/prod/theming/getThemeDesignerTheme.js.map +7 -0
- package/dist/prod/thirdparty/_merge.js +2 -0
- package/dist/prod/thirdparty/_merge.js.map +7 -0
- package/dist/prod/thirdparty/isPlainObject.js +2 -0
- package/dist/prod/thirdparty/isPlainObject.js.map +7 -0
- package/dist/prod/thirdparty/merge.js +2 -0
- package/dist/prod/thirdparty/merge.js.map +7 -0
- package/dist/prod/types/AnimationMode.js +2 -0
- package/dist/prod/types/AnimationMode.js.map +7 -0
- package/dist/prod/types/AriaHasPopup.js +2 -0
- package/dist/prod/types/AriaHasPopup.js.map +7 -0
- package/dist/prod/types/AriaLandmarkRole.js +2 -0
- package/dist/prod/types/AriaLandmarkRole.js.map +7 -0
- package/dist/prod/types/AriaRole.js +2 -0
- package/dist/prod/types/AriaRole.js.map +7 -0
- package/dist/prod/types/CSSColor.js +2 -0
- package/dist/prod/types/CSSColor.js.map +7 -0
- package/dist/prod/types/CSSSize.js +2 -0
- package/dist/prod/types/CSSSize.js.map +7 -0
- package/dist/prod/types/CalendarType.js +2 -0
- package/dist/prod/types/CalendarType.js.map +7 -0
- package/dist/prod/types/DOMReference.js +2 -0
- package/dist/prod/types/DOMReference.js.map +7 -0
- package/dist/prod/types/DataType.js +2 -0
- package/dist/prod/types/DataType.js.map +7 -0
- package/dist/prod/types/Float.js +2 -0
- package/dist/prod/types/Float.js.map +7 -0
- package/dist/prod/types/Integer.js +2 -0
- package/dist/prod/types/Integer.js.map +7 -0
- package/dist/prod/types/InvisibleMessageMode.js +2 -0
- package/dist/prod/types/InvisibleMessageMode.js.map +7 -0
- package/dist/prod/types/ItemNavigationBehavior.js +2 -0
- package/dist/prod/types/ItemNavigationBehavior.js.map +7 -0
- package/dist/prod/types/MovePlacement.js +2 -0
- package/dist/prod/types/MovePlacement.js.map +7 -0
- package/dist/prod/types/NavigationMode.js +2 -0
- package/dist/prod/types/NavigationMode.js.map +7 -0
- package/dist/prod/types/Orientation.js +2 -0
- package/dist/prod/types/Orientation.js.map +7 -0
- package/dist/prod/types/ValueState.js +2 -0
- package/dist/prod/types/ValueState.js.map +7 -0
- package/dist/prod/types.js +2 -0
- package/dist/prod/types.js.map +7 -0
- package/dist/prod/updateShadowRoot.js +2 -0
- package/dist/prod/updateShadowRoot.js.map +7 -0
- package/dist/prod/util/AriaLabelHelper.js +2 -0
- package/dist/prod/util/AriaLabelHelper.js.map +7 -0
- package/dist/prod/util/Caret.js +2 -0
- package/dist/prod/util/Caret.js.map +7 -0
- package/dist/prod/util/ColorConversion.js +2 -0
- package/dist/prod/util/ColorConversion.js.map +7 -0
- package/dist/prod/util/FetchHelper.js +2 -0
- package/dist/prod/util/FetchHelper.js.map +7 -0
- package/dist/prod/util/FocusableElements.js +2 -0
- package/dist/prod/util/FocusableElements.js.map +7 -0
- package/dist/prod/util/HTMLSanitizer.js +2 -0
- package/dist/prod/util/HTMLSanitizer.js.map +7 -0
- package/dist/prod/util/InvisibleMessage.js +2 -0
- package/dist/prod/util/InvisibleMessage.js.map +7 -0
- package/dist/prod/util/PopupUtils.js +2 -0
- package/dist/prod/util/PopupUtils.js.map +7 -0
- package/dist/prod/util/SlotsHelper.js +2 -0
- package/dist/prod/util/SlotsHelper.js.map +7 -0
- package/dist/prod/util/StringHelper.js +2 -0
- package/dist/prod/util/StringHelper.js.map +7 -0
- package/dist/prod/util/TabbableElements.js +2 -0
- package/dist/prod/util/TabbableElements.js.map +7 -0
- package/dist/prod/util/arraysAreEqual.js +2 -0
- package/dist/prod/util/arraysAreEqual.js.map +7 -0
- package/dist/prod/util/clamp.js +2 -0
- package/dist/prod/util/clamp.js.map +7 -0
- package/dist/prod/util/createLinkInHead.js +2 -0
- package/dist/prod/util/createLinkInHead.js.map +7 -0
- package/dist/prod/util/debounce.js +2 -0
- package/dist/prod/util/debounce.js.map +7 -0
- package/dist/prod/util/detectNavigatorLanguage.js +2 -0
- package/dist/prod/util/detectNavigatorLanguage.js.map +7 -0
- package/dist/prod/util/dragAndDrop/DragRegistry.js +2 -0
- package/dist/prod/util/dragAndDrop/DragRegistry.js.map +7 -0
- package/dist/prod/util/dragAndDrop/findClosestPosition.js +2 -0
- package/dist/prod/util/dragAndDrop/findClosestPosition.js.map +7 -0
- package/dist/prod/util/dragAndDrop/longDragOverHandler.js +2 -0
- package/dist/prod/util/dragAndDrop/longDragOverHandler.js.map +7 -0
- package/dist/prod/util/escapeRegex.js +2 -0
- package/dist/prod/util/escapeRegex.js.map +7 -0
- package/dist/prod/util/formatMessage.js +2 -0
- package/dist/prod/util/formatMessage.js.map +7 -0
- package/dist/prod/util/generateHighlightedMarkup.js +2 -0
- package/dist/prod/util/generateHighlightedMarkup.js.map +7 -0
- package/dist/prod/util/getActiveElement.js +2 -0
- package/dist/prod/util/getActiveElement.js.map +7 -0
- package/dist/prod/util/getClassCopy.js +2 -0
- package/dist/prod/util/getClassCopy.js.map +7 -0
- package/dist/prod/util/getDesigntimePropertyAsArray.js +2 -0
- package/dist/prod/util/getDesigntimePropertyAsArray.js.map +7 -0
- package/dist/prod/util/getEffectiveContentDensity.js +2 -0
- package/dist/prod/util/getEffectiveContentDensity.js.map +7 -0
- package/dist/prod/util/getEffectiveScrollbarStyle.js +2 -0
- package/dist/prod/util/getEffectiveScrollbarStyle.js.map +7 -0
- package/dist/prod/util/getFastNavigationGroups.js +2 -0
- package/dist/prod/util/getFastNavigationGroups.js.map +7 -0
- package/dist/prod/util/getFileExtension.js +2 -0
- package/dist/prod/util/getFileExtension.js.map +7 -0
- package/dist/prod/util/getNormalizedTarget.js +2 -0
- package/dist/prod/util/getNormalizedTarget.js.map +7 -0
- package/dist/prod/util/getParentElement.js +2 -0
- package/dist/prod/util/getParentElement.js.map +7 -0
- package/dist/prod/util/getSingletonElementInstance.js +2 -0
- package/dist/prod/util/getSingletonElementInstance.js.map +7 -0
- package/dist/prod/util/isElementClickable.js +2 -0
- package/dist/prod/util/isElementClickable.js.map +7 -0
- package/dist/prod/util/isElementContainingBlock.js +2 -0
- package/dist/prod/util/isElementContainingBlock.js.map +7 -0
- package/dist/prod/util/isElementHidden.js +2 -0
- package/dist/prod/util/isElementHidden.js.map +7 -0
- package/dist/prod/util/isElementInView.js +2 -0
- package/dist/prod/util/isElementInView.js.map +7 -0
- package/dist/prod/util/isElementTabbable.js +2 -0
- package/dist/prod/util/isElementTabbable.js.map +7 -0
- package/dist/prod/util/isValidPropertyName.js +2 -0
- package/dist/prod/util/isValidPropertyName.js.map +7 -0
- package/dist/prod/util/whenDOMReady.js +2 -0
- package/dist/prod/util/whenDOMReady.js.map +7 -0
- package/dist/prod/util/willShowContent.js +2 -0
- package/dist/prod/util/willShowContent.js.map +7 -0
- package/dist/prod/validateThemeRoot.js +2 -0
- package/dist/prod/validateThemeRoot.js.map +7 -0
- package/dist/renderer/executeTemplate.d.ts +8 -0
- package/dist/renderer/executeTemplate.js +1 -0
- package/dist/renderer/executeTemplate.js.map +1 -1
- package/dist/util/InvisibleMessage.js +2 -2
- package/dist/util/InvisibleMessage.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +9 -1
- package/package-scripts.cjs +5 -0
- package/package.json +11 -5
- package/dist/StaticArea.d.ts +0 -3
- package/dist/StaticArea.js +0 -7
- package/dist/StaticArea.js.map +0 -1
|
@@ -0,0 +1,750 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2024 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
import BaseConfig from "./config.js";
|
|
7
|
+
import now from "./util/now.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Logging API for JavaScript.
|
|
10
|
+
*
|
|
11
|
+
* Provides methods to manage a client-side log and to create entries in it. Each of the logging methods
|
|
12
|
+
* {@link module:sap/base/Log.debug}, {@link module:sap/base/Log.info}, {@link module:sap/base/Log.warning},
|
|
13
|
+
* {@link module:sap/base/Log.error} and {@link module:sap/base/Log.fatal} creates and records a log entry,
|
|
14
|
+
* containing a timestamp, a log level, a message with details and a component info.
|
|
15
|
+
* The log level will be one of {@link module:sap/base/Log.Level} and equals the name of the concrete logging method.
|
|
16
|
+
*
|
|
17
|
+
* By using the {@link module:sap/base/Log.setLevel} method, consumers can determine the least important
|
|
18
|
+
* log level which should be recorded. Less important entries will be filtered out. (Note that higher numeric
|
|
19
|
+
* values represent less important levels). The initially set level depends on the mode that UI5 is running in.
|
|
20
|
+
* When the optimized sources are executed, the default level will be {@link module:sap/base/Log.Level.ERROR}.
|
|
21
|
+
* For normal (debug sources), the default level is {@link module:sap/base/Log.Level.DEBUG}.
|
|
22
|
+
*
|
|
23
|
+
* All logging methods allow to specify a <b>component</b>. These components are simple strings and
|
|
24
|
+
* don't have a special meaning to the UI5 framework. However they can be used to semantically group
|
|
25
|
+
* log entries that belong to the same software component (or feature). There are two APIs that help
|
|
26
|
+
* to manage logging for such a component. With {@link module:sap/base/Log.getLogger},
|
|
27
|
+
* one can retrieve a logger that automatically adds the given <code>sComponent</code> as component
|
|
28
|
+
* parameter to each log entry, if no other component is specified. Typically, JavaScript code will
|
|
29
|
+
* retrieve such a logger once during startup and reuse it for the rest of its lifecycle.
|
|
30
|
+
* Second, the {@link module:sap/base/Log.setLevel}(iLevel, sComponent) method allows to set the log level
|
|
31
|
+
* for a specific component only. This allows a more fine grained control about the created logging entries.
|
|
32
|
+
* {@link module:sap/base/Log.getLevel} allows to retrieve the currently effective log level for a given
|
|
33
|
+
* component.
|
|
34
|
+
*
|
|
35
|
+
* {@link module:sap/base/Log.getLogEntries} returns an array of the currently collected log entries.
|
|
36
|
+
*
|
|
37
|
+
* Furthermore, a listener can be registered to the log. It will be notified whenever a new entry
|
|
38
|
+
* is added to the log. The listener can be used for displaying log entries in a separate page area,
|
|
39
|
+
* or for sending it to some external target (server).
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @since 1.58
|
|
43
|
+
* @namespace
|
|
44
|
+
* @alias module:sap/base/Log
|
|
45
|
+
*/
|
|
46
|
+
var Log = {};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Enumeration of the configurable log levels that a Logger should persist to the log.
|
|
50
|
+
*
|
|
51
|
+
* Only if the current LogLevel is higher than the level {@link module:sap/base/Log.Level} of the currently added log entry,
|
|
52
|
+
* then this very entry is permanently added to the log. Otherwise it is ignored.
|
|
53
|
+
* @enum {int}
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
Log.Level = {
|
|
57
|
+
/**
|
|
58
|
+
* Do not log anything
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
NONE: -1,
|
|
62
|
+
/**
|
|
63
|
+
* Fatal level. Use this for logging unrecoverable situations
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
FATAL: 0,
|
|
67
|
+
/**
|
|
68
|
+
* Error level. Use this for logging of erroneous but still recoverable situations
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
ERROR: 1,
|
|
72
|
+
/**
|
|
73
|
+
* Warning level. Use this for logging unwanted but foreseen situations
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
WARNING: 2,
|
|
77
|
+
/**
|
|
78
|
+
* Info level. Use this for logging information of purely informative nature
|
|
79
|
+
* @public
|
|
80
|
+
*/
|
|
81
|
+
INFO: 3,
|
|
82
|
+
/**
|
|
83
|
+
* Debug level. Use this for logging information necessary for debugging
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
DEBUG: 4,
|
|
87
|
+
/**
|
|
88
|
+
* Trace level. Use this for tracing the program flow.
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
TRACE: 5,
|
|
92
|
+
/**
|
|
93
|
+
* Trace level to log everything.
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
ALL: 5 + 1
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The array that holds the log entries that have been recorded so far
|
|
101
|
+
*/
|
|
102
|
+
var aLog = [],
|
|
103
|
+
/**
|
|
104
|
+
* Maximum log level to be recorded (per component).
|
|
105
|
+
*/
|
|
106
|
+
mMaxLevel = {
|
|
107
|
+
'': Log.Level.ERROR
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Maximum amount of stored log entries
|
|
111
|
+
*/
|
|
112
|
+
iLogEntriesLimit = 3000,
|
|
113
|
+
/**
|
|
114
|
+
* Registered listener to be informed about new log entries.
|
|
115
|
+
*/
|
|
116
|
+
oListener = null,
|
|
117
|
+
/**
|
|
118
|
+
* Additional support information delivered by callback should be logged
|
|
119
|
+
*/
|
|
120
|
+
bLogSupportInfo = false;
|
|
121
|
+
function pad0(i, w) {
|
|
122
|
+
return ("000" + String(i)).slice(-w);
|
|
123
|
+
}
|
|
124
|
+
function level(sComponent) {
|
|
125
|
+
return !sComponent || isNaN(mMaxLevel[sComponent]) ? mMaxLevel[''] : mMaxLevel[sComponent];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Discard 30 percent of log entries when the limit is reached
|
|
130
|
+
*/
|
|
131
|
+
function discardLogEntries() {
|
|
132
|
+
var iLogLength = aLog.length;
|
|
133
|
+
if (iLogLength) {
|
|
134
|
+
var iEntriesToKeep = Math.min(iLogLength, Math.floor(iLogEntriesLimit * 0.7));
|
|
135
|
+
if (oListener) {
|
|
136
|
+
// Notify listener that entries are being discarded
|
|
137
|
+
oListener.onDiscardLogEntries(aLog.slice(0, iLogLength - iEntriesToKeep));
|
|
138
|
+
}
|
|
139
|
+
if (iEntriesToKeep) {
|
|
140
|
+
aLog = aLog.slice(-iEntriesToKeep, iLogLength);
|
|
141
|
+
} else {
|
|
142
|
+
aLog = [];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Gets the log entry listener instance, if not present creates a new one
|
|
149
|
+
* @returns {Object} the singleton log entry listener
|
|
150
|
+
*/
|
|
151
|
+
function getLogEntryListenerInstance() {
|
|
152
|
+
if (!oListener) {
|
|
153
|
+
oListener = {
|
|
154
|
+
listeners: [],
|
|
155
|
+
onLogEntry: function (oLogEntry) {
|
|
156
|
+
for (var i = 0; i < oListener.listeners.length; i++) {
|
|
157
|
+
if (oListener.listeners[i].onLogEntry) {
|
|
158
|
+
oListener.listeners[i].onLogEntry(oLogEntry);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
onDiscardLogEntries: function (aDiscardedLogEntries) {
|
|
163
|
+
for (var i = 0; i < oListener.listeners.length; i++) {
|
|
164
|
+
if (oListener.listeners[i].onDiscardLogEntries) {
|
|
165
|
+
oListener.listeners[i].onDiscardLogEntries(aDiscardedLogEntries);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
attach: function (oLog, oLstnr) {
|
|
170
|
+
if (oLstnr) {
|
|
171
|
+
oListener.listeners.push(oLstnr);
|
|
172
|
+
if (oLstnr.onAttachToLog) {
|
|
173
|
+
oLstnr.onAttachToLog(oLog);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
detach: function (oLog, oLstnr) {
|
|
178
|
+
for (var i = 0; i < oListener.listeners.length; i++) {
|
|
179
|
+
if (oListener.listeners[i] === oLstnr) {
|
|
180
|
+
if (oLstnr.onDetachFromLog) {
|
|
181
|
+
oLstnr.onDetachFromLog(oLog);
|
|
182
|
+
}
|
|
183
|
+
oListener.listeners.splice(i, 1);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return oListener;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Creates a new fatal-level entry in the log with the given message, details and calling component.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} sMessage
|
|
197
|
+
* Message text to display
|
|
198
|
+
* @param {string|Error} [vDetails='']
|
|
199
|
+
* Optional details about the message, might be omitted. Can be an Error object which will be
|
|
200
|
+
* logged together with its stacktrace.
|
|
201
|
+
* @param {string} [sComponent='']
|
|
202
|
+
* Name of the component that produced the log entry
|
|
203
|
+
* @param {function} [fnSupportInfo]
|
|
204
|
+
* Callback that returns an additional support object to be logged in support mode.
|
|
205
|
+
* This function is only called if support info mode is turned on with
|
|
206
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
207
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
208
|
+
* static and stable content.
|
|
209
|
+
* @public
|
|
210
|
+
* @SecSink {0 1 2|SECRET} Could expose secret data in logs
|
|
211
|
+
*/
|
|
212
|
+
Log.fatal = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
213
|
+
log(Log.Level.FATAL, sMessage, vDetails, sComponent, fnSupportInfo);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Creates a new error-level entry in the log with the given message, details and calling component.
|
|
218
|
+
*
|
|
219
|
+
* @param {string} sMessage
|
|
220
|
+
* Message text to display
|
|
221
|
+
* @param {string|Error} [vDetails='']
|
|
222
|
+
* Optional details about the message, might be omitted. Can be an Error object which will be
|
|
223
|
+
* logged together with its stacktrace.
|
|
224
|
+
* @param {string} [sComponent='']
|
|
225
|
+
* Name of the component that produced the log entry
|
|
226
|
+
* @param {function} [fnSupportInfo]
|
|
227
|
+
* Callback that returns an additional support object to be logged in support mode.
|
|
228
|
+
* This function is only called if support info mode is turned on with
|
|
229
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
230
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
231
|
+
* static and stable content.
|
|
232
|
+
* @public
|
|
233
|
+
* @SecSink {0 1 2|SECRET} Could expose secret data in logs
|
|
234
|
+
*/
|
|
235
|
+
Log.error = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
236
|
+
log(Log.Level.ERROR, sMessage, vDetails, sComponent, fnSupportInfo);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Creates a new warning-level entry in the log with the given message, details and calling component.
|
|
241
|
+
*
|
|
242
|
+
* @param {string} sMessage
|
|
243
|
+
* Message text to display
|
|
244
|
+
* @param {string|Error} [vDetails='']
|
|
245
|
+
* Optional details about the message, might be omitted. Can be an Error object which will be
|
|
246
|
+
* logged together with its stacktrace.
|
|
247
|
+
* @param {string} [sComponent='']
|
|
248
|
+
* Name of the component that produced the log entry
|
|
249
|
+
* @param {function} [fnSupportInfo]
|
|
250
|
+
* Callback that returns an additional support object to be logged in support mode.
|
|
251
|
+
* This function is only called if support info mode is turned on with
|
|
252
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
253
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
254
|
+
* static and stable content.
|
|
255
|
+
* @public
|
|
256
|
+
* @SecSink {0 1 2|SECRET} Could expose secret data in logs
|
|
257
|
+
*/
|
|
258
|
+
Log.warning = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
259
|
+
log(Log.Level.WARNING, sMessage, vDetails, sComponent, fnSupportInfo);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Creates a new info-level entry in the log with the given message, details and calling component.
|
|
264
|
+
*
|
|
265
|
+
* @param {string} sMessage
|
|
266
|
+
* Message text to display
|
|
267
|
+
* @param {string|Error} [vDetails='']
|
|
268
|
+
* Optional details about the message, might be omitted. Can be an Error object which will be
|
|
269
|
+
* logged with the stack.
|
|
270
|
+
* @param {string} [sComponent='']
|
|
271
|
+
* Name of the component that produced the log entry
|
|
272
|
+
* @param {function} [fnSupportInfo]
|
|
273
|
+
* Callback that returns an additional support object to be logged in support mode.
|
|
274
|
+
* This function is only called if support info mode is turned on with
|
|
275
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
276
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
277
|
+
* static and stable content.
|
|
278
|
+
* @public
|
|
279
|
+
* @SecSink {0 1 2|SECRET} Could expose secret data in logs
|
|
280
|
+
*/
|
|
281
|
+
Log.info = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
282
|
+
log(Log.Level.INFO, sMessage, vDetails, sComponent, fnSupportInfo);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Creates a new debug-level entry in the log with the given message, details and calling component.
|
|
287
|
+
*
|
|
288
|
+
* @param {string} sMessage
|
|
289
|
+
* Message text to display
|
|
290
|
+
* @param {string|Error} [vDetails='']
|
|
291
|
+
* Optional details about the message, might be omitted. Can be an Error object which will be
|
|
292
|
+
* logged with the stack.
|
|
293
|
+
* @param {string} [sComponent='']
|
|
294
|
+
* Name of the component that produced the log entry
|
|
295
|
+
* @param {function} [fnSupportInfo]
|
|
296
|
+
* Callback that returns an additional support object to be logged in support mode.
|
|
297
|
+
* This function is only called if support info mode is turned on with
|
|
298
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
299
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
300
|
+
* static and stable content.
|
|
301
|
+
* @public
|
|
302
|
+
* @SecSink {0 1 2|SECRET} Could expose secret data in logs
|
|
303
|
+
*/
|
|
304
|
+
Log.debug = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
305
|
+
log(Log.Level.DEBUG, sMessage, vDetails, sComponent, fnSupportInfo);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Creates a new trace-level entry in the log with the given message, details and calling component.
|
|
310
|
+
*
|
|
311
|
+
* @param {string} sMessage
|
|
312
|
+
* Message text to display
|
|
313
|
+
* @param {string|Error} [vDetails='']
|
|
314
|
+
* Optional details about the message, might be omitted. Can be an Error object which will be
|
|
315
|
+
* logged with the stack.
|
|
316
|
+
* @param {string} [sComponent='']
|
|
317
|
+
* Name of the component that produced the log entry
|
|
318
|
+
* @param {function} [fnSupportInfo]
|
|
319
|
+
* Callback that returns an additional support object to be logged in support mode.
|
|
320
|
+
* This function is only called if support info mode is turned on with
|
|
321
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
322
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
323
|
+
* static and stable content.
|
|
324
|
+
* @public
|
|
325
|
+
* @SecSink {0 1 2|SECRET} Could expose secret data in logs
|
|
326
|
+
*/
|
|
327
|
+
Log.trace = function (sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
328
|
+
log(Log.Level.TRACE, sMessage, vDetails, sComponent, fnSupportInfo);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Defines the maximum <code>sap/base/Log.Level</code> of log entries that will be recorded.
|
|
333
|
+
* Log entries with a higher (less important) log level will be omitted from the log.
|
|
334
|
+
* When a component name is given, the log level will be configured for that component
|
|
335
|
+
* only, otherwise the log level for the default component of this logger is set.
|
|
336
|
+
* For the global logger, the global default level is set.
|
|
337
|
+
*
|
|
338
|
+
* <b>Note</b>: Setting a global default log level has no impact on already defined
|
|
339
|
+
* component log levels. They always override the global default log level.
|
|
340
|
+
*
|
|
341
|
+
* @param {module:sap/base/Log.Level} iLogLevel The new log level
|
|
342
|
+
* @param {string} [sComponent] The log component to set the log level for
|
|
343
|
+
* @public
|
|
344
|
+
*/
|
|
345
|
+
Log.setLevel = function (iLogLevel, sComponent, _bDefault) {
|
|
346
|
+
sComponent = sComponent || '';
|
|
347
|
+
if (!_bDefault || mMaxLevel[sComponent] == null) {
|
|
348
|
+
mMaxLevel[sComponent] = iLogLevel;
|
|
349
|
+
var sLogLevel;
|
|
350
|
+
Object.keys(Log.Level).forEach(function (sLevel) {
|
|
351
|
+
if (Log.Level[sLevel] === iLogLevel) {
|
|
352
|
+
sLogLevel = sLevel;
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
log(Log.Level.INFO, "Changing log level " + (sComponent ? "for '" + sComponent + "' " : "") + "to " + sLogLevel, "", "sap.base.log");
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Returns the log level currently effective for the given component.
|
|
361
|
+
* If no component is given or when no level has been configured for a
|
|
362
|
+
* given component, the log level for the default component of this logger is returned.
|
|
363
|
+
*
|
|
364
|
+
* @param {string} [sComponent] Name of the component to retrieve the log level for
|
|
365
|
+
* @returns {module:sap/base/Log.Level} The log level for the given component or the default log level
|
|
366
|
+
* @public
|
|
367
|
+
*/
|
|
368
|
+
Log.getLevel = function (sComponent) {
|
|
369
|
+
return level(sComponent);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Checks whether logging is enabled for the given log level,
|
|
374
|
+
* depending on the currently effective log level for the given component.
|
|
375
|
+
*
|
|
376
|
+
* If no component is given, the default component of this logger will be taken into account.
|
|
377
|
+
*
|
|
378
|
+
* @param {module:sap/base/Log.Level} [iLevel=Level.DEBUG] The log level in question
|
|
379
|
+
* @param {string} [sComponent] Name of the component to check the log level for
|
|
380
|
+
* @returns {boolean} Whether logging is enabled or not
|
|
381
|
+
* @public
|
|
382
|
+
*/
|
|
383
|
+
Log.isLoggable = function (iLevel, sComponent) {
|
|
384
|
+
return (iLevel == null ? Log.Level.DEBUG : iLevel) <= level(sComponent);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Enables or disables whether additional support information is logged in a trace.
|
|
389
|
+
* If enabled, logging methods like error, warning, info and debug are calling the additional
|
|
390
|
+
* optional callback parameter fnSupportInfo and store the returned object in the log entry property supportInfo.
|
|
391
|
+
*
|
|
392
|
+
* @param {boolean} bEnabled true if the support information should be logged
|
|
393
|
+
* @private
|
|
394
|
+
* @ui5-restricted sap.ui.support
|
|
395
|
+
*/
|
|
396
|
+
Log.logSupportInfo = function (bEnabled) {
|
|
397
|
+
bLogSupportInfo = bEnabled;
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Creates a new log entry depending on its level and component.
|
|
402
|
+
*
|
|
403
|
+
* If the given level is higher than the max level for the given component
|
|
404
|
+
* (or higher than the global level, if no component is given),
|
|
405
|
+
* then no entry is created and <code>undefined</code> is returned.
|
|
406
|
+
*
|
|
407
|
+
* If an <code>Error</code> is passed via <code>vDetails</code> the stack
|
|
408
|
+
* of the <code>Error</code> will be logged as a separate parameter in
|
|
409
|
+
* the proper <code>console</code> function for the matching log level.
|
|
410
|
+
*
|
|
411
|
+
* @param {module:sap/base/Log.Level} iLevel
|
|
412
|
+
* One of the log levels FATAL, ERROR, WARNING, INFO, DEBUG, TRACE
|
|
413
|
+
* @param {string} sMessage
|
|
414
|
+
* The message to be logged
|
|
415
|
+
* @param {string|Error} [vDetails]
|
|
416
|
+
* The optional details for the message; could be an Error which will be logged with the
|
|
417
|
+
* stacktrace, to easily find the root cause of the Error
|
|
418
|
+
* @param {string} [sComponent]
|
|
419
|
+
* The log component under which the message should be logged
|
|
420
|
+
* @param {function} [fnSupportInfo] Callback that returns an additional support object to be
|
|
421
|
+
* logged in support mode. This function is only called if support info mode is turned on with
|
|
422
|
+
* <code>logSupportInfo(true)</code>. To avoid negative effects regarding execution times and
|
|
423
|
+
* memory consumption, the returned object should be a simple immutable JSON object with mostly
|
|
424
|
+
* static and stable content.
|
|
425
|
+
* @returns {module:sap/base/Log.Entry}
|
|
426
|
+
* The log entry as an object or <code>undefined</code> if no entry was created
|
|
427
|
+
* @private
|
|
428
|
+
*/
|
|
429
|
+
function log(iLevel, sMessage, vDetails, sComponent, fnSupportInfo) {
|
|
430
|
+
if (!fnSupportInfo && !sComponent && typeof vDetails === "function") {
|
|
431
|
+
fnSupportInfo = vDetails;
|
|
432
|
+
vDetails = "";
|
|
433
|
+
}
|
|
434
|
+
if (!fnSupportInfo && typeof sComponent === "function") {
|
|
435
|
+
fnSupportInfo = sComponent;
|
|
436
|
+
sComponent = "";
|
|
437
|
+
}
|
|
438
|
+
if (iLevel <= level(sComponent)) {
|
|
439
|
+
var fNow = now(),
|
|
440
|
+
oNow = new Date(fNow),
|
|
441
|
+
iMicroSeconds = Math.floor((fNow - Math.floor(fNow)) * 1000),
|
|
442
|
+
oLogEntry = {
|
|
443
|
+
time: pad0(oNow.getHours(), 2) + ":" + pad0(oNow.getMinutes(), 2) + ":" + pad0(oNow.getSeconds(), 2) + "." + pad0(oNow.getMilliseconds(), 3) + pad0(iMicroSeconds, 3),
|
|
444
|
+
date: pad0(oNow.getFullYear(), 4) + "-" + pad0(oNow.getMonth() + 1, 2) + "-" + pad0(oNow.getDate(), 2),
|
|
445
|
+
timestamp: fNow,
|
|
446
|
+
level: iLevel,
|
|
447
|
+
message: String(sMessage || ""),
|
|
448
|
+
details: String(vDetails || ""),
|
|
449
|
+
component: String(sComponent || "")
|
|
450
|
+
};
|
|
451
|
+
if (bLogSupportInfo && typeof fnSupportInfo === "function") {
|
|
452
|
+
oLogEntry.supportInfo = fnSupportInfo();
|
|
453
|
+
}
|
|
454
|
+
if (iLogEntriesLimit) {
|
|
455
|
+
if (aLog.length >= iLogEntriesLimit) {
|
|
456
|
+
// Cap the amount of stored log messages by 30 percent
|
|
457
|
+
discardLogEntries();
|
|
458
|
+
}
|
|
459
|
+
aLog.push(oLogEntry);
|
|
460
|
+
}
|
|
461
|
+
if (oListener) {
|
|
462
|
+
oListener.onLogEntry(oLogEntry);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/*
|
|
466
|
+
* Console Log, also tries to log to the console, if available.
|
|
467
|
+
*
|
|
468
|
+
* Unfortunately, the support for console is quite different between the UI5 browsers. The most important differences are:
|
|
469
|
+
* - in FF3.6 the console is not available, until FireBug is opened. It disappears again, when fire bug is closed.
|
|
470
|
+
* But when the settings for a web site are stored (convenience), the console remains open
|
|
471
|
+
* When the console is available, it supports all relevant methods
|
|
472
|
+
* - in FF9.0, the console is always available, but method assert is only available when firebug is open
|
|
473
|
+
* - in Webkit browsers, the console object is always available and has all required methods
|
|
474
|
+
* - Exception: in the iOS Simulator, console.info() does not exist
|
|
475
|
+
*/
|
|
476
|
+
/*eslint-disable no-console */
|
|
477
|
+
if (console) {
|
|
478
|
+
// in Firefox, console might not exist or it might even disappear
|
|
479
|
+
var isDetailsError = vDetails instanceof Error,
|
|
480
|
+
logText = oLogEntry.date + " " + oLogEntry.time + " " + oLogEntry.message + " - " + oLogEntry.details + " " + oLogEntry.component;
|
|
481
|
+
switch (iLevel) {
|
|
482
|
+
case Log.Level.FATAL:
|
|
483
|
+
case Log.Level.ERROR:
|
|
484
|
+
isDetailsError ? console.error(logText, "\n", vDetails) : console.error(logText);
|
|
485
|
+
break;
|
|
486
|
+
case Log.Level.WARNING:
|
|
487
|
+
isDetailsError ? console.warn(logText, "\n", vDetails) : console.warn(logText);
|
|
488
|
+
break;
|
|
489
|
+
case Log.Level.INFO:
|
|
490
|
+
if (console.info) {
|
|
491
|
+
// info not available in iOS simulator
|
|
492
|
+
isDetailsError ? console.info(logText, "\n", vDetails) : console.info(logText);
|
|
493
|
+
} else {
|
|
494
|
+
isDetailsError ? console.log(logText, "\n", vDetails) : console.log(logText);
|
|
495
|
+
}
|
|
496
|
+
break;
|
|
497
|
+
case Log.Level.DEBUG:
|
|
498
|
+
isDetailsError ? console.debug(logText, "\n", vDetails) : console.debug(logText);
|
|
499
|
+
break;
|
|
500
|
+
case Log.Level.TRACE:
|
|
501
|
+
isDetailsError ? console.trace(logText, "\n", vDetails) : console.trace(logText);
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
if (console.info && oLogEntry.supportInfo) {
|
|
505
|
+
console.info(oLogEntry.supportInfo);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
/*eslint-enable no-console */
|
|
509
|
+
return oLogEntry;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Returns the logged entries recorded so far as an array.
|
|
515
|
+
*
|
|
516
|
+
* Log entries are plain JavaScript objects with the following properties
|
|
517
|
+
* <ul>
|
|
518
|
+
* <li>timestamp {number} point in time when the entry was created
|
|
519
|
+
* <li>level {module:sap/base/Log.Level} LogLevel level of the entry
|
|
520
|
+
* <li>message {string} message text of the entry
|
|
521
|
+
* </ul>
|
|
522
|
+
* The default amount of stored log entries is limited to 3000 entries.
|
|
523
|
+
* @returns {Array<module:sap/base/Log.Entry>} an array containing the recorded log entries
|
|
524
|
+
* @public
|
|
525
|
+
* @static
|
|
526
|
+
*/
|
|
527
|
+
Log.getLogEntries = function () {
|
|
528
|
+
return aLog.slice();
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Returns the maximum amount of stored log entries.
|
|
533
|
+
*
|
|
534
|
+
* @returns {int|Infinity} The maximum amount of stored log entries or Infinity if no limit is set
|
|
535
|
+
* @private
|
|
536
|
+
* @ui5-restricted
|
|
537
|
+
*/
|
|
538
|
+
Log.getLogEntriesLimit = function () {
|
|
539
|
+
return iLogEntriesLimit;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Sets the limit of stored log entries
|
|
544
|
+
*
|
|
545
|
+
* If the new limit is lower than the current limit, the overlap of old log entries will be discarded.
|
|
546
|
+
* If the limit is reached the amount of stored messages will be reduced by 30 percent.
|
|
547
|
+
*
|
|
548
|
+
* @param {int|Infinity} iLimit The maximum amount of stored log entries or Infinity for unlimited entries
|
|
549
|
+
* @private
|
|
550
|
+
* @ui5-restricted
|
|
551
|
+
*/
|
|
552
|
+
Log.setLogEntriesLimit = function (iLimit) {
|
|
553
|
+
if (iLimit < 0) {
|
|
554
|
+
throw new Error("The log entries limit needs to be greater than or equal to 0!");
|
|
555
|
+
}
|
|
556
|
+
iLogEntriesLimit = iLimit;
|
|
557
|
+
if (aLog.length >= iLogEntriesLimit) {
|
|
558
|
+
discardLogEntries();
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* @typedef {object} module:sap/base/Log.Entry
|
|
564
|
+
* @property {float} timestamp The number of milliseconds since the epoch
|
|
565
|
+
* @property {string} time Time string in format HH:mm:ss:mmmnnn
|
|
566
|
+
* @property {string} date Date string in format yyyy-MM-dd
|
|
567
|
+
* @property {module:sap/base/Log.Level} level The level of the log entry, see {@link module:sap/base/Log.Level}
|
|
568
|
+
* @property {string} message The message of the log entry
|
|
569
|
+
* @property {string} details The detailed information of the log entry
|
|
570
|
+
* @property {string} component The component that creates the log entry
|
|
571
|
+
* @property {function():any} [supportInfo] Callback that returns an additional support object to be
|
|
572
|
+
* logged in support mode.
|
|
573
|
+
* @public
|
|
574
|
+
*/
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Interface to be implemented by a log listener.
|
|
578
|
+
*
|
|
579
|
+
* Typically, a listener will at least implement the {@link #.onLogEntry} method,
|
|
580
|
+
* but in general, all methods are optional.
|
|
581
|
+
*
|
|
582
|
+
* @interface
|
|
583
|
+
* @name module:sap/base/Log.Listener
|
|
584
|
+
* @public
|
|
585
|
+
*/
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The function that is called when a new log entry is created
|
|
589
|
+
*
|
|
590
|
+
* @param {module:sap/base/Log.Entry} oLogEntry The newly created log entry
|
|
591
|
+
* @name module:sap/base/Log.Listener.onLogEntry?
|
|
592
|
+
* @function
|
|
593
|
+
* @public
|
|
594
|
+
*/
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* The function that is called once the Listener is attached
|
|
598
|
+
*
|
|
599
|
+
* @param {module:sap/base/Log} oLog The Log instance where the listener is attached
|
|
600
|
+
* @name module:sap/base/Log.Listener.onAttachToLog?
|
|
601
|
+
* @function
|
|
602
|
+
* @public
|
|
603
|
+
*/
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* The function that is called once the Listener is detached
|
|
607
|
+
*
|
|
608
|
+
* @param {module:sap/base/Log} oLog The Log instance where the listener is detached
|
|
609
|
+
* @name module:sap/base/Log.Listener.onDetachFromLog?
|
|
610
|
+
* @function
|
|
611
|
+
* @public
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* The function that is called once log entries are discarded due to the exceed of total log entry amount
|
|
616
|
+
*
|
|
617
|
+
* @param {Array<module:sap/base/Log.Entry>} aDiscardedEntries The discarded log entries
|
|
618
|
+
* @name module:sap/base/Log.Listener.onDiscardLogEntries?
|
|
619
|
+
* @function
|
|
620
|
+
* @public
|
|
621
|
+
*/
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Allows to add a new listener that will be notified for new log entries.
|
|
625
|
+
*
|
|
626
|
+
* The given object must provide method <code>onLogEntry</code> and can also be informed
|
|
627
|
+
* about <code>onDetachFromLog</code>, <code>onAttachToLog</code> and <code>onDiscardLogEntries</code>.
|
|
628
|
+
* @param {module:sap/base/Log.Listener} oListener The new listener object that should be informed
|
|
629
|
+
* @public
|
|
630
|
+
* @static
|
|
631
|
+
*/
|
|
632
|
+
Log.addLogListener = function (oListener) {
|
|
633
|
+
getLogEntryListenerInstance().attach(this, oListener);
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Allows to remove a registered LogListener.
|
|
638
|
+
* @param {module:sap/base/Log.Listener} oListener The listener object that should be removed
|
|
639
|
+
* @public
|
|
640
|
+
* @static
|
|
641
|
+
*/
|
|
642
|
+
Log.removeLogListener = function (oListener) {
|
|
643
|
+
getLogEntryListenerInstance().detach(this, oListener);
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* The logger comes with a subset of the API of the <code>sap/base/Log</code> module:
|
|
648
|
+
* <ul>
|
|
649
|
+
* <li><code>#fatal</code> - see: {@link module:sap/base/Log.fatal}
|
|
650
|
+
* <li><code>#error</code> - see: {@link module:sap/base/Log.error}
|
|
651
|
+
* <li><code>#warning</code> - see: {@link module:sap/base/Log.warning}
|
|
652
|
+
* <li><code>#info</code> - see: {@link module:sap/base/Log.info}
|
|
653
|
+
* <li><code>#debug</code> - see: {@link module:sap/base/Log.debug}
|
|
654
|
+
* <li><code>#trace</code> - see: {@link module:sap/base/Log.trace}
|
|
655
|
+
* <li><code>#setLevel</code> - see: {@link module:sap/base/Log.setLevel}
|
|
656
|
+
* <li><code>#getLevel</code> - see: {@link module:sap/base/Log.getLevel}
|
|
657
|
+
* <li><code>#isLoggable</code> - see: {@link module:sap/base/Log.isLoggable}
|
|
658
|
+
* </ul>
|
|
659
|
+
* @interface
|
|
660
|
+
* @borrows module:sap/base/Log.fatal as #fatal
|
|
661
|
+
* @borrows module:sap/base/Log.error as #error
|
|
662
|
+
* @borrows module:sap/base/Log.warning as #warning
|
|
663
|
+
* @borrows module:sap/base/Log.info as #info
|
|
664
|
+
* @borrows module:sap/base/Log.debug as #debug
|
|
665
|
+
* @borrows module:sap/base/Log.trace as #trace
|
|
666
|
+
* @borrows module:sap/base/Log.setLevel as #setLevel
|
|
667
|
+
* @borrows module:sap/base/Log.getLevel as #getLevel
|
|
668
|
+
* @borrows module:sap/base/Log.isLoggable as #isLoggable
|
|
669
|
+
* @name module:sap/base/Log.Logger
|
|
670
|
+
* @public
|
|
671
|
+
*/
|
|
672
|
+
function Logger(sComponent) {
|
|
673
|
+
this.fatal = function (msg, detail, comp, support) {
|
|
674
|
+
Log.fatal(msg, detail, comp || sComponent, support);
|
|
675
|
+
return this;
|
|
676
|
+
};
|
|
677
|
+
this.error = function (msg, detail, comp, support) {
|
|
678
|
+
Log.error(msg, detail, comp || sComponent, support);
|
|
679
|
+
return this;
|
|
680
|
+
};
|
|
681
|
+
this.warning = function (msg, detail, comp, support) {
|
|
682
|
+
Log.warning(msg, detail, comp || sComponent, support);
|
|
683
|
+
return this;
|
|
684
|
+
};
|
|
685
|
+
this.info = function (msg, detail, comp, support) {
|
|
686
|
+
Log.info(msg, detail, comp || sComponent, support);
|
|
687
|
+
return this;
|
|
688
|
+
};
|
|
689
|
+
this.debug = function (msg, detail, comp, support) {
|
|
690
|
+
Log.debug(msg, detail, comp || sComponent, support);
|
|
691
|
+
return this;
|
|
692
|
+
};
|
|
693
|
+
this.trace = function (msg, detail, comp, support) {
|
|
694
|
+
Log.trace(msg, detail, comp || sComponent, support);
|
|
695
|
+
return this;
|
|
696
|
+
};
|
|
697
|
+
this.setLevel = function (level, comp) {
|
|
698
|
+
Log.setLevel(level, comp || sComponent);
|
|
699
|
+
return this;
|
|
700
|
+
};
|
|
701
|
+
this.getLevel = function (comp) {
|
|
702
|
+
return Log.getLevel(comp || sComponent);
|
|
703
|
+
};
|
|
704
|
+
this.isLoggable = function (level, comp) {
|
|
705
|
+
return Log.isLoggable(level, comp || sComponent);
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Returns a dedicated logger for a component.
|
|
711
|
+
*
|
|
712
|
+
* The logger comes with the same API as the <code>sap/base/Log</code> module:
|
|
713
|
+
* <ul>
|
|
714
|
+
* <li><code>#fatal</code> - see: {@link module:sap/base/Log.fatal}
|
|
715
|
+
* <li><code>#error</code> - see: {@link module:sap/base/Log.error}
|
|
716
|
+
* <li><code>#warning</code> - see: {@link module:sap/base/Log.warning}
|
|
717
|
+
* <li><code>#info</code> - see: {@link module:sap/base/Log.info}
|
|
718
|
+
* <li><code>#debug</code> - see: {@link module:sap/base/Log.debug}
|
|
719
|
+
* <li><code>#trace</code> - see: {@link module:sap/base/Log.trace}
|
|
720
|
+
* <li><code>#setLevel</code> - see: {@link module:sap/base/Log.setLevel}
|
|
721
|
+
* <li><code>#getLevel</code> - see: {@link module:sap/base/Log.getLevel}
|
|
722
|
+
* <li><code>#isLoggable</code> - see: {@link module:sap/base/Log.isLoggable}
|
|
723
|
+
* </ul>
|
|
724
|
+
*
|
|
725
|
+
* @param {string} sComponent Name of the component which should be logged
|
|
726
|
+
* @param {module:sap/base/Log.Level} [iDefaultLogLevel] The default log level
|
|
727
|
+
* @return {module:sap/base/Log.Logger} A logger with a specified component
|
|
728
|
+
* @public
|
|
729
|
+
* @static
|
|
730
|
+
*/
|
|
731
|
+
Log.getLogger = function (sComponent, iDefaultLogLevel) {
|
|
732
|
+
if (!isNaN(iDefaultLogLevel) && mMaxLevel[sComponent] == null) {
|
|
733
|
+
mMaxLevel[sComponent] = iDefaultLogLevel;
|
|
734
|
+
}
|
|
735
|
+
return new Logger(sComponent);
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
// set LogLevel
|
|
739
|
+
const sLogLevel = BaseConfig.get({
|
|
740
|
+
name: "sapUiLogLevel",
|
|
741
|
+
type: BaseConfig.Type.String,
|
|
742
|
+
defaultValue: undefined,
|
|
743
|
+
external: true
|
|
744
|
+
});
|
|
745
|
+
if (sLogLevel) {
|
|
746
|
+
Log.setLevel(Log.Level[sLogLevel.toUpperCase()] || parseInt(sLogLevel));
|
|
747
|
+
} else if (!globalThis["sap-ui-optimized"]) {
|
|
748
|
+
Log.setLevel(Log.Level.DEBUG);
|
|
749
|
+
}
|
|
750
|
+
export default Log;
|