Giter Site home page Giter Site logo

Comments (5)

akudev avatar akudev commented on August 17, 2024

Hi, this is the ui5-typescript repository and the issue report template says:

** IMPORTANT **
This tracker is for issues caused by the tools maintained here (type definition generator and ts-interface generator for control development support).
But if the bug is within the original OpenUI5/SAPUI5 code/JSDoc, then please report the issue there!

Right now I don't see how this report would be about the type definition generators of UI5. Do I miss anything?

If it is about setting the logging level in UI5, then the OpenUI5 repository would be the place to report. Additional information would then be helpful, like how exactly you have tried to set the log level and what UI5 version you are using and whether it is a standalone app or there's something around like FLP, which could also affect logging.

But anyway, a page with the following setting doesn't give me any logging:

<!DOCTYPE html>
<html>

<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta charset="utf-8">
	<title>OpenUI5 Logging App</title>

	<script id="sap-ui-bootstrap" src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
		data-sap-ui-theme="sap_fiori_3" data-sap-ui-libs="sap.m" data-sap-ui-compatVersion="edge">
		</script>

	<script>
		sap.ui.require(["sap/base/Log"], (Log) => {
			Log.setLevel(Log.Level.ERROR);

			// create a simple button
			var oButton = new sap.m.Button({
				text: "Hello World",
				press: function () {
					// log a message when the button is pressed
					console.log("Hello world button was pressed");
				}
			}).placeAt("content");
		})
		

	</script>
</head>

<body class="sapUiBody" id="content">
</body>

</html>

But changing the log level to TRACE gives a couple of lines of logging on startup. Please check whether this also works for you before opening that other ticket.

from ui5-typescript.

jamess0160 avatar jamess0160 commented on August 17, 2024

First, thanks for the help!

I forgot to mention that this is a problem that only occurred to me in TS projects, when I generate a JS project through the yeoman generator it has the normal log level and I believe I can change the level there, but I haven't tested it.

This is the script tag I'm currently using:

<script id="sap-ui-bootstrap" src="resources/sap-ui-core.js" data-sap-ui-resourceroots='{ "bti_framework": "./" }' data-sap-ui-theme="sap_horizon" data-sap-ui-oninit="module:sap/ui/core/ComponentSupport" data-sap-ui-async="true" data-sap-ui-compatVersion="edge" data-sap-ui-frameOptions="trusted" data-sap-ui-xx-waitForTheme="true" data-sap-ui-xx-supportedLanguages="en,de"></script>

I tested the script tag you sent and with just a few changes it worked, no more console logs. I dug a little deeper and noticed that what caused the logs to come out was the fact that your tag had the src at "https://openui5.hana.ondemand.com/resources/sap-ui-core.js" while mine has "resources/sap-ui-core.js", I believe the log problem is in that library. Unfortunately I can't just migrate to the CDN as I prefer the theme of the old version of sap horizon.

I added the log level change right below the script tag and it worked in parts, it's already better than before.

image

To look for a complete solution for this would I open an issue in the repository that is linked to npm in this case?

And again thanks for the help

from ui5-typescript.

akudev avatar akudev commented on August 17, 2024

Ah! Loading UI5 from "resources/sap-ui-core.js" means the UI5 tooling is providing it. I'm not exactly sure about the log-related mechanisms there, but anyway: when I check in the debugger who sets the log level debug, then it happens here:
https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/core/_ConfigurationProvider.js#L169

Adding data-sap-ui-logLevel="ERROR" to the bootstrap script should solve the issue.

from ui5-typescript.

akudev avatar akudev commented on August 17, 2024

Oh, and the difference is because you are running more or less against the debug sources of UI5 when using "resources/..." and against the optimized sources when using the CDN.
once you have done a UI5 build, you should also locally get the optimized ones (but now we are getting too far away from the TypeScript stuff supposedly discussed here. ;-)).

from ui5-typescript.

jamess0160 avatar jamess0160 commented on August 17, 2024

It worked!
Thanks a lot for the help, I finally have just the errors in the console.

from ui5-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.