{ "id": "116463", "key": "ALOY-723", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15816", "description": "2014 Sprint 02", "name": "2014 Sprint 02", "archived": true, "released": true, "releaseDate": "2014-01-31" } ], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2014-01-20T20:37:52.000+0000", "created": "2013-06-26T07:47:35.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "compile", "compiler", "log", "logging", "production" ], "versions": [], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2014-01-28T23:19:49.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "The compiler should remove {{Titanium.API.log}} (and {{console.log}}) calls from the code that are not relevant in production environments, being {{log}} and {{debug}}.\r\n\r\nAn implementation for this is already provided here:\r\nhttps://gist.github.com/tsteur/5745279", "attachment": [], "flagged": false, "summary": "Alloy: Remove log unimportant log calls in production", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Any", "comment": { "comments": [ { "id": "288845", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Investigating, I think this is already done by the platform.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-20T18:00:23.000+0000", "updated": "2014-01-20T18:00:23.000+0000" }, { "id": "288872", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "At the platform level, debug() messages are apparently not output though the other levels are output. Platform references:\n\n * iOS: https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/APIModule.m \n * Android: https://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/common/src/java/org/appcelerator/kroll/common/Log.java\n\nIf your concern is crossing the bridge, you can write a simple wrapper for the Ti.API.info() like the following:\n\n{code}\n/*\n Use:\n var log = require('logger');\n log.info('Logged, except in a production build');\n*/\n\n// put in app/lib/logger.js\nexports.info = function(str) {\n if(ENV_PRODUCTION) return;\n Ti.API.info(str);\n};\n{code}\n\n\nFor non-Alloy projects, add a custom property to tiapp.xml, and check for it, like this:\n\n{code}\n// in tiapp.xml, add:\nfalse\n\n// in your logger.js\n\nexports.info = function(str) {\n if(Ti.App.Properties.getBool('production', false)===true) return;\n Ti.API.info(str);\n};\n\n{code}", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-20T20:36:46.000+0000", "updated": "2014-01-20T20:36:46.000+0000" }, { "id": "288873", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "I'm marking this as \"won't fix\" because it's partially handled by the underlying platform and suitable workarounds are available.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-20T20:37:52.000+0000", "updated": "2014-01-20T20:37:52.000+0000" }, { "id": "288876", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~skypanther], you're worse then Tony ;)", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-01-20T21:10:40.000+0000", "updated": "2014-01-20T21:10:40.000+0000" }, { "id": "289163", "author": { "name": "mtondreau", "key": "mtondreau", "displayName": "Matthew Tondreau", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Looking at:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/APIModule.m#L53\r\nhttps://github.com/appcelerator/titanium_mobile/blob/master/android/runtime/v8/src/native/modules/APIModule.cpp#L169\r\n\r\nIs it correct to say in production (non-debug) iphone only logs error-level, where with android only debug-level is *not* displayed? ", "updateAuthor": { "name": "mtondreau", "key": "mtondreau", "displayName": "Matthew Tondreau", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-22T00:04:08.000+0000", "updated": "2014-01-22T00:04:08.000+0000" }, { "id": "289215", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Yes, Matthew, that's how the API level handles it. I've opened a docs ticket to document the behavior since it doesn't seem to be covered anywhere right now.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-22T14:05:52.000+0000", "updated": "2014-01-22T14:05:52.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }