Fix some error messages not being displayed

This commit is contained in:
Rafał Dzięgiel
2021-04-09 18:49:44 +02:00
parent dafa2cfdf5
commit d9939a94c2
4 changed files with 21 additions and 28 deletions

View File

@@ -31,16 +31,18 @@ const ytDebugger = new Debug.Debugger('YouTube', {
high_precision: true,
});
function _debug(msg, levelName, debuggerName)
function _debug(msg, debuggerName)
{
levelName = levelName || 'LEVEL_DEBUG';
if(msg.message) {
levelName = 'LEVEL_CRITICAL';
msg = msg.message;
GLib.log_structured(
debuggerName, GLib.LogLevelFlags.LEVEL_CRITICAL, {
MESSAGE: msg.message,
SYSLOG_IDENTIFIER: debuggerName.toLowerCase()
});
return;
}
if(levelName !== 'LEVEL_CRITICAL') {
switch(debuggerName) {
case 'Clapper':
clapperDebugger.debug(msg);
@@ -49,23 +51,14 @@ function _debug(msg, levelName, debuggerName)
ytDebugger.debug(msg);
break;
}
return;
}
GLib.log_structured(
debuggerName, GLib.LogLevelFlags[levelName], {
MESSAGE: msg,
SYSLOG_IDENTIFIER: debuggerName.toLowerCase()
});
}
function debug(msg, levelName)
function debug(msg)
{
_debug(msg, levelName, 'Clapper');
_debug(msg, 'Clapper');
}
function ytDebug(msg, levelName)
function ytDebug(msg)
{
_debug(msg, levelName, 'YouTube');
_debug(msg, 'YouTube');
}

View File

@@ -131,7 +131,7 @@ function getFileFromLocalUri(uri)
const file = Gio.file_new_for_uri(uri);
if(!file.query_exists(null)) {
debug(`file does not exist: ${file.get_path()}`, 'LEVEL_WARNING');
debug(new Error(`file does not exist: ${file.get_path()}`));
return null;
}

View File

@@ -448,7 +448,7 @@ class ClapperPlayer extends PlayerBase
_onPlayerWarning(player, error)
{
debug(error.message, 'LEVEL_WARNING');
debug(error.message);
}
_onPlayerError(player, error)

View File

@@ -283,7 +283,7 @@ class ClapperWidget extends Gtk.Grid
if(currStream && type !== 'subtitle') {
const caps = currStream.get_caps();
debug(`${type} caps: ${caps.to_string()}`, 'LEVEL_INFO');
debug(`${type} caps: ${caps.to_string()}`);
}
if(type === 'video') {
const isShowVis = (parsedInfo[`${type}Tracks`].length === 0);