Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11615] iOS: Ti.API.log: function calls with one arg (log level) do not print as the correct log level

GitHub Issuen/a
TypeSub-task
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2012-10-31T21:14:02.000+0000
Affected Version/sRelease 2.1.3, Release 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelsparity, qe-ios100112
ReporterDustin Hyde
AssigneeIngo Muschenetz
Created2012-10-30T23:54:59.000+0000
Updated2017-03-21T18:16:24.000+0000

Description

Ti.API.log console logging calls with one arg (log level) do not print as the correct log level. They all default to [INFO] instead. This does not occur in MobileWeb. This is a parity issue. This is also an inconsistency within the iOS platform because log with two args works as expected, as does calling Ti.API.log() and Ti.API.log('info'). Steps to Reproduce: 1. Run code:
Ti.API.log('trace');
Ti.API.log('debug');
Ti.API.log('warn');
Ti.API.log('error');
Ti.API.log('log');
Actual Result:
[INFO] trace
[INFO] debug
[INFO] warn
[INFO] error
[INFO] log
Expected Result:
[TRACE] trace
[DEBUG] debug
[WARN] warn
[ERROR] error
[LOG] log

Comments

  1. Dustin Hyde 2012-10-31

    MobileWeb should do what iOS is doing.
  2. Dustin Hyde 2012-10-31

    This is the correct behavior, if MobileWeb is showing the opposite we need a separate ticket.
  3. Dustin Hyde 2012-10-31

    Note that though this is the 'correct' behavior, the first argument to this function is supposed to be the log level, so passing in only the log level is expected to result in a message being logged at that level. Currently if there is one argument, it is treated as the second argument and is used to populate the message instead.
  4. Dustin Hyde 2012-10-31

    To put this into context, here is a sample output w/code: Code:
       /* console */
       
       console.debug();
       console.debug('console.debug');
       console.debug(['console.debug.0', 'console.debug.1']);
       
       /* Ti.API */
       
       Ti.API.debug();
       Ti.API.debug('Ti.API.debug');
       Ti.API.debug(['Ti.API.debug.0', 'Ti.API.debug.1']);
       
       Ti.API.log('debug');
       Ti.API.log('debug', 'Ti.API.log.debug');
       Ti.API.log('debug', ['Ti.API.debug.0', 'Ti.API.debug.1']);
       
    Output:
       [DEBUG] (null)
       [DEBUG] console.debug
       [DEBUG] (
           "console.debug.0",
           "console.debug.1"
       )
       [DEBUG] (null)
       [DEBUG] Ti.API.debug
       [DEBUG] (
           "Ti.API.debug.0",
           "Ti.API.debug.1"
       )
       [INFO] debug
       [DEBUG] Ti.API.log.debug
       [DEBUG] (
           "Ti.API.debug.0",
           "Ti.API.debug.1"
       )
       
  5. Lee Morris 2017-03-21

    Closing ticket as the issue will not fix.

JSON Source