Implement macros for Element::message_full_with_details()

Allows attaching arbitrary structures to error/warning/info messages
This commit is contained in:
Sebastian Dröge 2017-11-15 17:03:19 +02:00
parent 4ab5893359
commit 9734ec29cc

View file

@ -551,6 +551,85 @@ macro_rules! gst_element_error(
line!(),
);
}};
($obj:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Error,
$err,
Some($msg),
Some($debug),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($msg:expr), details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Error,
$err,
Some($msg),
None,
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, [$debug:expr], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Error,
$err,
None,
Some($debug),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Error,
$err,
Some(format!($($msg)*)),
Some(format!($($debug)*)),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Error,
$err,
Some(format!($($msg)*)),
None,
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Error,
$err,
None,
Some(format!($($debug)*)),
file!(),
module_path!(),
line!(),
$details,
);
}};
);
#[macro_export]
@ -627,6 +706,85 @@ macro_rules! gst_element_warning(
line!(),
);
}};
($obj:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Warning,
$err,
Some($msg),
Some($debug),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($msg:expr), details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Warning,
$err,
Some($msg),
None,
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, [$debug:expr], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Warning,
$err,
None,
Some($debug),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Warning,
$err,
Some(format!($($msg)*)),
Some(format!($($debug)*)),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Warning,
$err,
Some(format!($($msg)*)),
None,
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Warning,
$err,
None,
Some(format!($($debug)*)),
file!(),
module_path!(),
line!(),
$details,
);
}};
);
#[macro_export]
@ -703,6 +861,85 @@ macro_rules! gst_element_info(
line!(),
);
}};
($obj:expr, $err:expr, ($msg:expr), [$debug:expr], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Info,
$err,
Some($msg),
Some($debug),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($msg:expr), details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Info,
$err,
Some($msg),
None,
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, [$debug:expr], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Info,
$err,
None,
Some($debug),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($($msg:tt)*), [$($debug:tt)*], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Info,
$err,
Some(format!($($msg)*)),
Some(format!($($debug)*)),
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, ($($msg:tt)*), details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Info,
$err,
Some(format!($($msg)*)),
None,
file!(),
module_path!(),
line!(),
$details,
);
}};
($obj:expr, $err:expr, [$($debug:tt)*], details: $details:expr) => { {
use $crate::ElementExtManual;
$obj.message_full_with_details(
$crate::ElementMessageType::Info,
$err,
None,
Some(format!($($debug)*)),
file!(),
module_path!(),
line!(),
$details,
);
}};
);
#[cfg(test)]