Macro: Log the object where a macro is not found

fixes #3759
This commit is contained in:
Johannes Meyer 2022-09-28 14:49:04 +02:00
parent c133cbe4f8
commit dae7bf4657
1 changed files with 6 additions and 1 deletions

View File

@ -68,8 +68,13 @@ class Macro
try {
$value = $object->$macro;
} catch (Exception $e) {
$objectName = $object->getName();
if ($object instanceof Service) {
$objectName = $object->getHost()->getName() . '!' . $objectName;
}
$value = null;
Logger::debug('Unable to resolve macro "%s". An error occured: %s', $macro, $e);
Logger::debug('Unable to resolve macro "%s" on object "%s". An error occured: %s', $macro, $objectName, $e);
}
return $value !== null ? $value : $macro;