mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 16:31:58 +02:00
Add custom debug script with Gst version check
This commit is contained in:
33
clapper_src/debug.js
Normal file
33
clapper_src/debug.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const { GLib, Gst } = imports.gi;
|
||||
|
||||
const GST_VERSION = Gst.version();
|
||||
const REQ_GST_VER_MINOR = 16;
|
||||
|
||||
function debug(msg, levelName)
|
||||
{
|
||||
levelName = levelName || 'LEVEL_DEBUG';
|
||||
|
||||
if(msg instanceof Error) {
|
||||
levelName = 'LEVEL_CRITICAL';
|
||||
msg = msg.message;
|
||||
}
|
||||
GLib.log_structured(
|
||||
'Clapper', GLib.LogLevelFlags[levelName], {
|
||||
MESSAGE: msg,
|
||||
SYSLOG_IDENTIFIER: 'clapper'
|
||||
});
|
||||
}
|
||||
|
||||
function gstVersionCheck()
|
||||
{
|
||||
if(GST_VERSION[1] >= REQ_GST_VER_MINOR)
|
||||
return;
|
||||
|
||||
debug(
|
||||
'clapper interface was designed to' +
|
||||
` work with GStreamer 1.${REQ_GST_VER_MINOR} or later.` +
|
||||
` Your version is ${GST_VERSION[0]}.${GST_VERSION[1]}.` +
|
||||
' Please update GStreamer or expect some things to be broken.',
|
||||
'LEVEL_WARNING'
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user