Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11778] iOS: Ti.API: console.log and console.timestamp output prefixed with [ERROR] depending on previous message

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-11-07T01:35:33.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2013 Sprint 23, 2013 Sprint 23 Core, Release 3.2.0
ComponentsiOS
Labelsqe-sdk3.0.2, regression
ReporterDustin Hyde
AssigneeChris Barber
Created2012-11-15T15:47:01.000+0000
Updated2013-11-14T06:31:39.000+0000

Description

The new CLI is prefixing log output with [DEBUG]. The cases are:
Ti.API.log('unknown_level', ...)
and
Ti.API.timestamp(...)
Steps to Reproduce: 1. Run code:
Ti.API.log('LOG', 'Ti.API.log LOG');
Ti.API.log('LOG', ['Ti.API.log LOG', 'ARG1', 'ARG2']);
  
if(Ti.Platform.osname == 'iphone' || Ti.Platform.osname == 'ipad')
{
    Ti.API.timestamp('Ti.API TIMESTAMP');
    Ti.API.timestamp(['Ti.API TIMESTAMP', 'ARG1', 'ARG2']);
}
Actual Result:
[DEBUG] [LOG] Ti.API.log LOG
[DEBUG] [LOG] (
[DEBUG]     "Ti.API.log LOG",
[DEBUG]     ARG1,
[DEBUG]     ARG2
[DEBUG] ) 
[DEBUG] [TIMESTAMP] 374602955.638459 Ti.API TIMESTAMP
[DEBUG] [TIMESTAMP] 374602955.638546 (
[DEBUG]     "Ti.API TIMESTAMP",
[DEBUG]     ARG1,
[DEBUG]     ARG2
[DEBUG] ) 
Expected Result:
[LOG] Ti.API.log LOG
[LOG] (
    "Ti.API.log LOG",
    ARG1,
    ARG2
)
[TIMESTAMP] 374624326.619975 Ti.API TIMESTAMP
[TIMESTAMP] 374624326.620025 (
    "Ti.API TIMESTAMP",
    ARG1,
    ARG2
)
I would expect timestamp to print as INFO, or a custom TIMESTAMP (if possible).

Comments

  1. Dustin Hyde 2013-02-13

    Now the timestamp (and freeform 'LOG') is printed as ERROR.
       [ERROR] :  [LOG] Ti.API.log(LOG)
       [ERROR] :  [LOG] (
       [ERROR] :      arg0,
       [ERROR] :      arg1,
       [ERROR] :      arg2
       [ERROR] :  )
       [ERROR] :  [TIMESTAMP] 382417823.074028 Ti.API.timestamp()
       [ERROR] :  [TIMESTAMP] 382417823.074065 (
       [ERROR] :      arg0,
       [ERROR] :      arg1,
       [ERROR] :      arg2
       [ERROR] :  )
       
    Titanium Studio: 3.0.2.201302081641 Titanium SDK: 3.0.2.v20130207164659 Titanium CLI: 3.0.23 OS: 10.8.2 Xcode: 4.6 iPhone Simulator: 6.1
  2. Dustin Hyde 2013-02-13

    It seems the log level is dependent on if there is an array argument. Console calls without an array argument log to ERROR (incorrect). Console calls with an array argument, if called directly after, log to ERROR (incorrect). Console calls with an array argument, if called separately, log to INFO (correct). See Sample Code:
       Ti.API.log('custom', ['arg0', 'arg1']);
       Ti.API.log('custom');
       Ti.API.log('custom', ['arg0, arg1']);
       
    Output:
       [INFO] :  custom
       [DEBUG] :  [CUSTOM] (
       [INFO] :  [CUSTOM] (
       [DEBUG] :      arg0,
       [INFO] :      "arg0, arg1"
       [DEBUG] :      arg1
       [INFO] :  )
       [DEBUG] :  )
       
    Regression. Works in 2.1.4.
  3. Chris Barber 2013-11-06

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/4919
  4. Priya Agarwal 2013-11-14

    Verified with test environment: Appcelerator Studio: 3.2.0.201311122338 SDK:3.2.0.v20131113183932 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0 titanium-code-processor: 1.1.0 Xcode:5.0.2 Device: Iphone 5s(v7.0.2) OS: Mac OSX 10.9
       Ti.API.log('LOG', 'Ti.API.log LOG');
       Ti.API.log('LOG', ['Ti.API.log LOG', 'ARG1', 'ARG2']);
          
       if(Ti.Platform.osname == 'iphone' || Ti.Platform.osname == 'ipad')
       {
           Ti.API.timestamp('Ti.API TIMESTAMP');
           Ti.API.timestamp(['Ti.API TIMESTAMP', 'ARG1', 'ARG2']);
       }
       
    Result as expected: [LOG] Ti.API.log LOG [LOG] ( "Ti.API.log LOG", ARG1, ARG2 ) [TIMESTAMP] 406103132.967310 Ti.API TIMESTAMP [TIMESTAMP] 406103132.968250 ( "Ti.API TIMESTAMP", ARG1, ARG2 ) Closing as verified and getting expected result.

JSON Source