Make production build more quiet? #12816
-
first: yes it is very easy/quick to check if it is an Appcelerator app. eg. use Dexplorer and look at the AndroidManifset. Should the production build not log any Ti.API.* infos? E.g. there is always a "powered by" message. Android will only hide Ti.API.debug in production builds so it is always visible if you don't remove it on your own. I think maybe it shouldn't log anything there, if you want to get some logs: create a debug version 😄 Sources for the logging inside the SDK: https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/modules/APIModule.cpp |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes, this was intentional for production builds. Just like how the native logging functions still work for release builds. If you want to disable all logging functions for production/release builds, then add a new script file to your project named // Disable logging for release/production builds.
if (DIST_STORE) {
const emptyFunction = () => {};
Ti.API.info = emptyFunction;
Ti.API.warn = emptyFunction;
Ti.API.error = emptyFunction;
Ti.API.debug = emptyFunction;
Ti.API.trace = emptyFunction;
Ti.API.timestamp = emptyFunction;
Ti.API.log = emptyFunction;
console.log = emptyFunction;
console.warn = emptyFunction;
console.error = emptyFunction;
console.debug = emptyFunction;
console.trace = emptyFunction;
} Does this help? |
Beta Was this translation helpful? Give feedback.
Yes, this was intentional for production builds. Just like how the native logging functions still work for release builds.
If you want to disable all logging functions for production/release builds, then add a new script file to your project named
DisableLogging.bootstrap.js
with the below code. This will replace all logging functions to make them no-op. Note that files ending with*.bootstrap.js
will be loaded by Titanium before theapp.js
oralloy.js
(it's an undocumented feature). Also note that this will not block the "Powered by Titanium" log message since bootstrap scripts are loaded afterwards, but this was the intent on our end.