Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noisy console log messages #96

Open
swashbuck opened this issue Aug 20, 2024 · 1 comment · May be fixed by #97
Open

Noisy console log messages #96

swashbuck opened this issue Aug 20, 2024 · 1 comment · May be fixed by #97
Assignees

Comments

@swashbuck
Copy link
Contributor

Subject of the issue

In end-trickle.js, statements about when Trickle starts and ends are output to the console.

Trickle started
Trickle ended
Trickle started
Trickle ended
Trickle started
Trickle ended

This adds unnecessary messages to the console that are not valuable unless you are specifically troubleshooting a Trickle issue.

Screenshot 2024-06-20 at 10 24 35 AM

I would suggest one of the following:

  1. Remove these console messages entirely
  2. Change these to console.debug()
  3. Add a new option to suppress all console log messages originating from Dev Tools. Something like _quietMode or _suppressConsoleLogs.
@swashbuck swashbuck changed the title Add option to suppress console log messages Noisy console log messages Aug 20, 2024
@oliverfoster
Copy link
Member

Reference line:

console.log('Trickle started');

There are four extra pipes/function to the console api which can help filter the output:

console.debug
console.info
console.warn
console.error

Messages like those in this issue which are for debugging, should not be posted to console.log but instead indirectly to console.debug through logging.debug.

Adapt has a logging system which should be used instead of direct console logs, this can be seen at the url below:
https://github.com/adaptlearning/adapt-contrib-core/blob/9bc7db2480b8f7b3dfb9579637fc9f94cdd2d6fa/js/logging.js#L51-L86

Adapt's logging system is configured in the config.json as can be seen in this schema:
https://github.com/adaptlearning/adapt-contrib-core/blob/9bc7db2480b8f7b3dfb9579637fc9f94cdd2d6fa/schema/config.schema.json#L348-L382

It is possible to set a default logging level in the config.json such that only messages from the specified level upward are output to the console. The logging levels are listed in the logLevelEnum file.

Otherwise, here is an article on how to subsequently filter the console in a browser, such that the browser console only shows messages of the various types:

https://medium.com/@rhyneav/chromes-console-filters-and-how-to-use-them-63f2ff1c148b

It is probably wise not to remove logs used for debugging, but it is a good idea to output them to the correct pipe and to use the Adapt's APIs to do so.

@swashbuck swashbuck self-assigned this Oct 3, 2024
@swashbuck swashbuck linked a pull request Oct 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants