gstreamer/log: Allow any glib::Object as target for logging

gst::Object is not actually required. For plain glib::Objects only the
pointer address is printed instead of a name but it works fine.
This commit is contained in:
Sebastian Dröge 2020-02-22 18:35:02 +02:00
parent 0e69898faf
commit 67e6afc628
2 changed files with 4 additions and 4 deletions

View file

@ -145,7 +145,7 @@ impl LoggableError {
pub fn log(&self) {
self.category.log(
None as Option<&::Object>,
None as Option<&glib::Object>,
::DebugLevel::Error,
self.bool_error.filename,
self.bool_error.function,
@ -154,7 +154,7 @@ impl LoggableError {
);
}
pub fn log_with_object<O: IsA<::Object>>(&self, obj: &O) {
pub fn log_with_object<O: IsA<glib::Object>>(&self, obj: &O) {
self.category.log(
Some(obj),
::DebugLevel::Error,

View file

@ -122,7 +122,7 @@ impl DebugCategory {
}
#[inline]
pub fn log<O: IsA<::Object>>(
pub fn log<O: IsA<glib::Object>>(
self,
obj: Option<&O>,
level: ::DebugLevel,
@ -304,7 +304,7 @@ macro_rules! gst_log_with_level(
module_path!(), line!(), format_args!($($args)*))
}};
($cat:expr, level: $level:expr, $($args:tt)*) => { {
$crate::DebugCategory::log($cat.clone(), None as Option<&$crate::Object>, $level, file!(),
$crate::DebugCategory::log($cat.clone(), None as Option<&$crate::glib::Object>, $level, file!(),
module_path!(), line!(), format_args!($($args)*))
}};
);