mirror of
https://github.com/Rafostar/clapper.git
synced 2025-09-03 01:41:58 +02:00
Port to new gtuber lib
Current YouTube code was broken for quite some time. Replace it with the new Gtuber lib to make this code separate, independent and easier to maintain.
This commit is contained in:
40
src/debug.js
40
src/debug.js
@@ -14,22 +14,13 @@ const clapperDebugger = new Debug.Debugger('Clapper', {
|
||||
}),
|
||||
high_precision: true,
|
||||
});
|
||||
clapperDebugger.enabled = (
|
||||
|
||||
var enabled = (
|
||||
clapperDebugger.enabled
|
||||
|| G_DEBUG_ENV != null
|
||||
&& G_DEBUG_ENV.includes('Clapper')
|
||||
);
|
||||
|
||||
const ytDebugger = new Debug.Debugger('YouTube', {
|
||||
name_printer: new Ink.Printer({
|
||||
font: Ink.Font.BOLD,
|
||||
color: Ink.Color.RED
|
||||
}),
|
||||
time_printer: new Ink.Printer({
|
||||
color: Ink.Color.LIGHT_BLUE
|
||||
}),
|
||||
high_precision: true,
|
||||
});
|
||||
clapperDebugger.enabled = enabled;
|
||||
|
||||
function _logStructured(debuggerName, msg, level)
|
||||
{
|
||||
@@ -43,23 +34,12 @@ function _logStructured(debuggerName, msg, level)
|
||||
function _debug(debuggerName, msg)
|
||||
{
|
||||
if(msg.message) {
|
||||
_logStructured(
|
||||
debuggerName,
|
||||
msg.message,
|
||||
_logStructured(debuggerName, msg.message,
|
||||
GLib.LogLevelFlags.LEVEL_CRITICAL
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch(debuggerName) {
|
||||
case 'Clapper':
|
||||
clapperDebugger.debug(msg);
|
||||
break;
|
||||
case 'YouTube':
|
||||
ytDebugger.debug(msg);
|
||||
break;
|
||||
}
|
||||
clapperDebugger.debug(msg);
|
||||
}
|
||||
|
||||
function debug(msg)
|
||||
@@ -67,12 +47,12 @@ function debug(msg)
|
||||
_debug('Clapper', msg);
|
||||
}
|
||||
|
||||
function ytDebug(msg)
|
||||
{
|
||||
_debug('YouTube', msg);
|
||||
}
|
||||
|
||||
function warn(msg)
|
||||
{
|
||||
_logStructured('Clapper', msg, GLib.LogLevelFlags.LEVEL_WARNING);
|
||||
}
|
||||
|
||||
function message(msg)
|
||||
{
|
||||
_logStructured('Clapper', msg, GLib.LogLevelFlags.LEVEL_MESSAGE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user