Channel

log. Channel

Creates a new log channel that can be accessed by log.<channel_key>() for logging. Should ideally be initialised upon startup. This is used for custom multi-channel logging. Channels are mirrored in DevTools as well as having DOM-facing viewports and consoles via ve.Log, ve.ScriptManager.

Constructor:
  • arg0_key; string - The key to use for channel logging. log.<channel_key>, log.<channel_key>_warn, log.<channel_key>_error are valid channels afterwards.
  • arg1_options: Object
    • .colour: Array<number, number, number, number>|string - The colour to use for the background.
    • .do_not_print=false: boolean - Whether to not print to console.
    • .large_object_limit=10000: number - The limit at which large object warnings should be emitted.
    • .text_colour: Array<number, number, number, number>|string - The text colour to use for the foreground. Detected as either 'white/'black' based on luminance by default.
Instance:
Methods:
  • clear()
  • close()
  • error(argn_arguments:any)
  • fromJSON(arg0_json:string)
  • log(argn_arguments:any)
  • open()
  • warn(argn_arguments:any)
  • print(arg0_type:string, argn_arguments:any)
  • remove()
  • save(arg0_file_path:string, arg1_options:Object) | string
  • toJSON() | string
Static Fields:
Static Methods:
  • update() - Updates all ve.Log instances and alphabetically sorts channel order.

Constructor

new Channel()

Source:

Methods

#update()

Updates all associated log.Channel components to ensure that they remain in-sync.

Source:

clear()

Clears the current console channel.

Source:

close()

Closes the available console window if already open.

Source:

error(…argn_arguments)

Prints an error message to the console channel, analogous to console.error.

Source:
Parameters:
Name Type Attributes Description
argn_arguments <repeatable>

fromJSON(arg0_json)

Loads a log history from a JSON string and restores the internal HTML.

Source:
Parameters:
Name Type Description
arg0_json string

The JSON string to load.

log(…argn_arguments)

Prints a log message to the console channel, analogous to console.log.

Source:
Parameters:
Name Type Attributes Description
argn_arguments <repeatable>

open()

Opens a UI for the given console channel. DOM-facing.

Source:

print(arg0_type, argn_arguments)

Prints a message to the given console channel.

Source:
Parameters:
Name Type Description
arg0_type string

The console type. Either 'log'/'warn'/'error'.

argn_arguments Array.<any>

The arguments passed to the log function

remove()

Removes the given console channel.

Source:

save(arg0_file_path, arg1_optionsopt) → {string}

Saves the present log to a given file path. Returns the output text written.

Source:
Parameters:
Name Type Attributes Description
arg0_file_path string
arg1_options Object <optional>
Name Type Attributes Default Description
format string <optional>
"plaintext"

Either 'json'/'plaintext'.

Returns:
Type:
string

toJSON() → {string}

Serialises the current log channel's entire history and configuration to a JSON string.

Source:
Returns:
Type:
string

warn(…argn_arguments)

Prints a warning message to the console channel, analogous to console.warn.

Source:
Parameters:
Name Type Attributes Description
argn_arguments <repeatable>