REST environment: add static log_warn function

which avoids the need for the caller to check whether the environment
was initialized or not.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-10-29 13:16:22 +02:00 committed by Thomas Lamprecht
parent cc78c1eba2
commit 06885ac8bb

View File

@ -715,6 +715,17 @@ sub fork_worker {
return wantarray ? ($upid, $res) : $upid;
}
sub log_warn {
my ($message) = @_;
if ($rest_env) {
$rest_env->warn($message);
} else {
chomp($message);
print STDERR "WARN: $message\n";
}
}
sub warn {
my ($self, $message) = @_;