diff --git a/src/debug.js b/src/debug.js index 81b6b063..d5d0eb35 100644 --- a/src/debug.js +++ b/src/debug.js @@ -31,14 +31,23 @@ const ytDebugger = new Debug.Debugger('YouTube', { high_precision: true, }); -function _debug(msg, debuggerName) +function _logStructured(debuggerName, msg, level) +{ + GLib.log_structured( + debuggerName, level, { + MESSAGE: msg, + SYSLOG_IDENTIFIER: debuggerName.toLowerCase() + }); +} + +function _debug(debuggerName, msg) { if(msg.message) { - GLib.log_structured( - debuggerName, GLib.LogLevelFlags.LEVEL_CRITICAL, { - MESSAGE: msg.message, - SYSLOG_IDENTIFIER: debuggerName.toLowerCase() - }); + _logStructured( + debuggerName, + msg.message, + GLib.LogLevelFlags.LEVEL_CRITICAL + ); return; } @@ -55,10 +64,15 @@ function _debug(msg, debuggerName) function debug(msg) { - _debug(msg, 'Clapper'); + _debug('Clapper', msg); } function ytDebug(msg) { - _debug(msg, 'YouTube'); + _debug('YouTube', msg); +} + +function warn(msg) +{ + _logStructured('Clapper', msg, GLib.LogLevelFlags.LEVEL_WARNING); } diff --git a/src/player.js b/src/player.js index f447a120..3cbc1e26 100644 --- a/src/player.js +++ b/src/player.js @@ -6,7 +6,7 @@ const YouTube = imports.src.youtube; const { PlaylistWidget } = imports.src.playlist; const { WebApp } = imports.src.webApp; -const { debug } = Debug; +const { debug, warn } = Debug; const { settings } = Misc; let WebServer; @@ -119,8 +119,10 @@ class ClapperPlayer extends GstClapper.Clapper { const gstRegistry = Gst.Registry.get(); const feature = gstRegistry.lookup_feature(name); - if(!feature) - return debug(`plugin unavailable: ${name}`); + if(!feature) { + warn(`cannot change rank of unavailable plugin: ${name}`); + return; + } const oldRank = feature.get_rank(); if(rank === oldRank)