Console Logger

Overall idea

The console-logger is a noninteractive tool used to log messages sent to Opera's console.

All messages sent to the Opera console from the various modules in Opera are captured and displayed.

A logged datum has six parts:

BNF

Here is the grammar describing the data. Some of the data elements are described in more detail below.

  ###
  # The protocol is a one-way XML-based protocol, with data flowing from the
  # host to the debugger client.
  #
  # The service name of the Console logger is "console-logger".
  #

  PROTOCOL ::= MESSAGE* ;

  MESSAGE ::= "<message>"
                TIME
                URI?
                CONTEXT?
                SOURCE?
                SEVERITY?
                WINDOW-ID
                DESCRIPTION
              "</message>"
              ;

  # The number of seconds since 1970-01-01T00:00:00Z.
  
  TIME ::= "<time>"
             UNSIGNED
           "</time>"
           ;

  # The URL of the entity (document, script, style file, etc) that caused the
  # message to be generated.

  URI ::= "<uri>"
            TEXT
          "</uri>"
          ;

  # The context in which the message was generated; it is intended for human
  # consumption and provides additional information about the context for the
  # message.

  CONTEXT ::= "<context>"
                TEXT
              "</context>"
              ;

  # The component in Opera that generated the message

  SOURCE ::= "<source>"
               ( "ecmascript" | "java" | "m2" | "network" | "xml" | "html" |
                 "css" | "xslt" | "svg" | "bittorrent" | "voice" | "widget" |
                 "selftest" )
             "</source>"
             ;

  SEVERITY ::= "<severity>"
                 ( "debug" | "verbose" | "information" | "error" | "critical" )
               "</severity>"
               ;

  # Description of the error. Sometimes this message only makes sense when
  # displayed in a monospace font.

  DESCRIPTION ::= "<description>"
                    TEXT
                  "</description>"
                  ;

  # The window ID is shared across scope. Notably, it's the same as in the ecmascript debugger.
  # INTERNAL: The value is from Window::id

  WINDOW-ID ::= "<window-id>" UNSIGNED "</window-id>" ;

  ###
  # Primitive data.
  #
  # You may *NOT* assume that an UNSIGNED received from the host fits 
  # in 32 bits, but you may assume that 64 bits is enough.
  #
  # You must *NOT* send an UNSIGNED to the host that does not fit in 32
  # bits unless it was received from the host.
  #

  UNSIGNED ::= [0-9]+ ;

  TEXT ::= BASE64-ENCODED-DATA | textual-data ;

  BASE64-ENCODED-DATA ::= "<base64-encoded-data>" textual-data "</base64-encoded-data>" ;