js: implement mp.msg.trace()

To match the new Lua helper introduced in
1afdeee1ad

Add documentation for both.
This commit is contained in:
TheAMM 2017-12-16 10:18:20 +02:00 committed by Kevin Mitchell
parent 1afdeee1ad
commit 3c4667c862
3 changed files with 8 additions and 5 deletions

View File

@ -164,6 +164,8 @@ Otherwise, where the Lua APIs return ``nil`` on error, JS returns ``undefined``.
``mp.msg.debug(...)``
``mp.msg.trace(...)``
``mp.utils.getcwd()`` (LE)
``mp.utils.readdir(path [, filter])`` (LE)

View File

@ -487,16 +487,17 @@ with ``require 'mp.msg'``.
``msg.log(level, ...)``
The level parameter is the message priority. It's a string and one of
``fatal``, ``error``, ``warn``, ``info``, ``v``, ``debug``. The user's
settings will determine which of these messages will be visible. Normally,
all messages are visible, except ``v`` and ``debug``.
``fatal``, ``error``, ``warn``, ``info``, ``v``, ``debug``, ``trace``. The
user's settings will determine which of these messages will be
visible. Normally, all messages are visible, except ``v``, ``debug`` and
``trace``.
The parameters after that are all converted to strings. Spaces are inserted
to separate multiple parameters.
You don't need to add newlines.
``msg.fatal(...)``, ``msg.error(...)``, ``msg.warn(...)``, ``msg.info(...)``, ``msg.verbose(...)``, ``msg.debug(...)``
``msg.fatal(...)``, ``msg.error(...)``, ``msg.warn(...)``, ``msg.info(...)``, ``msg.verbose(...)``, ``msg.debug(...)``, ``msg.trace(...)``
All of these are shortcuts and equivalent to the corresponding
``msg.log(level, ...)`` call.

View File

@ -7,7 +7,7 @@
mp.msg = { log: mp.log };
mp.msg.verbose = mp.log.bind(null, "v");
var levels = ["fatal", "error", "warn", "info", "debug"];
var levels = ["fatal", "error", "warn", "info", "debug", "trace"];
levels.forEach(function(l) { mp.msg[l] = mp.log.bind(null, l) });
// same as {} but without inherited stuff, e.g. o["toString"] doesn't exist.