⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259618 in webkit


Ignore:
Timestamp:
Apr 6, 2020, 6:04:05 PM (6 years ago)
Author:
Devin Rousso
Message:

Web Inspector: console.log(...) appear as CONSOLE LOG LOG in the system console
https://bugs.webkit.org/show_bug.cgi?id=210083

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

  • runtime/ConsoleClient.cpp:

(JSC::appendMessagePrefix):

Source/WebCore:

  • page/PageConsoleClient.cpp:

(WebCore::PageConsoleClient::addMessage):
Use the actual MessageSource and MessageType when printing console messages.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r259614 r259618  
     12020-04-06  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: `console.log(...)` appear as `CONSOLE LOG LOG` in the system console
     4        https://bugs.webkit.org/show_bug.cgi?id=210083
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * runtime/ConsoleClient.cpp:
     9        (JSC::appendMessagePrefix):
     10
    1112020-04-06  Mark Lam  <mark.lam@apple.com>
    212
  • trunk/Source/JavaScriptCore/runtime/ConsoleClient.cpp

    r259236 r259618  
    6363    String sourceString;
    6464    switch (source) {
     65    case MessageSource::ConsoleAPI:
     66        // Default, no need to be more specific.
     67        break;
    6568    case MessageSource::XML:
    6669        sourceString = "XML"_s;
     
    7275        sourceString = "NETWORK"_s;
    7376        break;
    74     case MessageSource::ConsoleAPI:
    75         sourceString = "CONSOLE"_s;
    76         break;
    7777    case MessageSource::Storage:
    7878        sourceString = "STORAGE"_s;
     
    110110    case MessageSource::Other:
    111111        sourceString = "OTHER"_s;
    112         break;
    113     }
    114 
    115     String levelString;
    116     switch (level) {
    117     case MessageLevel::Debug:
    118         levelString = "DEBUG"_s;
    119         break;
    120     case MessageLevel::Log:
    121         levelString = "LOG"_s;
    122         break;
    123     case MessageLevel::Info:
    124         levelString = "INFO"_s;
    125         break;
    126     case MessageLevel::Warning:
    127         levelString = "WARN"_s;
    128         break;
    129     case MessageLevel::Error:
    130         levelString = "ERROR"_s;
    131112        break;
    132113    }
     
    135116    switch (type) {
    136117    case MessageType::Log:
    137         typeString = "LOG"_s;
     118        // Default, no need to be more specific.
    138119        break;
    139120    case MessageType::Clear:
     
    178159    }
    179160
    180     builder.append(sourceString);
    181     builder.append(' ');
    182     builder.append(levelString);
    183     builder.append(' ');
    184     builder.append(typeString);
     161    String levelString;
     162    switch (level) {
     163    case MessageLevel::Log:
     164        // Default, no need to be more specific.
     165        if (type == MessageType::Log)
     166            levelString = "LOG"_s;
     167        break;
     168    case MessageLevel::Debug:
     169        levelString = "DEBUG"_s;
     170        break;
     171    case MessageLevel::Info:
     172        levelString = "INFO"_s;
     173        break;
     174    case MessageLevel::Warning:
     175        levelString = "WARN"_s;
     176        break;
     177    case MessageLevel::Error:
     178        levelString = "ERROR"_s;
     179        break;
     180    }
     181
     182    builder.append("CONSOLE");
     183    if (!sourceString.isEmpty())
     184        builder.append(' ', sourceString);
     185    if (!typeString.isEmpty())
     186        builder.append(' ', typeString);
     187    if (!levelString.isEmpty())
     188        builder.append(' ', levelString);
    185189}
    186190
  • trunk/Source/WebCore/ChangeLog

    r259613 r259618  
     12020-04-06  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: `console.log(...)` appear as `CONSOLE LOG LOG` in the system console
     4        https://bugs.webkit.org/show_bug.cgi?id=210083
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * page/PageConsoleClient.cpp:
     9        (WebCore::PageConsoleClient::addMessage):
     10        Use the actual `MessageSource` and `MessageType` when printing console messages.
     11
    1122020-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
    213
  • trunk/Source/WebCore/page/PageConsoleClient.cpp

    r256822 r259618  
    132132            if (consoleMessage->type() == MessageType::Image) {
    133133                ASSERT(consoleMessage->arguments());
    134                 ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, MessageType::Log, consoleMessage->level(), consoleMessage->arguments()->globalObject(), *consoleMessage->arguments());
     134                ConsoleClient::printConsoleMessageWithArguments(consoleMessage->source(), consoleMessage->type(), consoleMessage->level(), consoleMessage->arguments()->globalObject(), *consoleMessage->arguments());
    135135            } else
    136                 ConsoleClient::printConsoleMessage(MessageSource::ConsoleAPI, MessageType::Log, consoleMessage->level(), consoleMessage->message(), consoleMessage->url(), consoleMessage->line(), consoleMessage->column());
     136                ConsoleClient::printConsoleMessage(consoleMessage->source(), consoleMessage->type(), consoleMessage->level(), consoleMessage->message(), consoleMessage->url(), consoleMessage->line(), consoleMessage->column());
    137137        }
    138138    }
Note: See TracChangeset for help on using the changeset viewer.