BitsDevelopmentTeam / bits-server

Presence and logging daemon for BITS system.
GNU General Public License v3.0
5 stars 2 forks source link

Remove debug logging from Javascript #5

Closed esseks closed 11 years ago

esseks commented 11 years ago

Currently, the JS code is perfoming verbose logging.

Logging should be disabled in production and debug.js only required on test machines.

thypon commented 11 years ago

debug.js should be required however, the debug statements needs it, unless you want to strip also all the code.

It's possible to add a meta tag like this

<meta name="mode" content="production" />
esseks commented 11 years ago

Debug mode should will be triggered by invoking bitsd.py with the --developer-mode flag, which is meant to activate all functions that help debugging (like module reload on changes) but are unwanted or even unsafe on a production machine.

I can easily include or exclude debug.js and append a tag to the head of the document when the aforementioned flag is set, do you need anything else?

thypon commented 11 years ago

Only add that tag.

No way to remove debug.js without breaking all badly...

esseks commented 11 years ago

This line:

debug.setLevel(query("meta[name='mode']").content);

throws an Uncaught Type Error. You have to test code before pushing to the upstream repo. Otherwise, feel free to experiment in your fork.

esseks commented 11 years ago

I committed the necessary server code and I changed a require line in you JS, so that at least it does not fail. Now fix it.

esseks commented 11 years ago

I fixed the code for you. Please never commit to the upstream repo again, unless at least another developer asked you to or the fix is so trivial (e.g. typos) that it is not suitable for a pull request. Direct push is certainly not ok for issues and code changes.