From: Arvin Schnell Date: Fri, 18 Jul 2025 07:53:54 +0000 (+0200) Subject: - nicer format for logging output of plugins X-Git-Tag: v0.13.0~97^2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=fc571a7d4a72bc98008de0f3418c506afda3c690;p=thirdparty%2Fsnapper.git - nicer format for logging output of plugins --- diff --git a/snapper/PluginsImpl.cc b/snapper/PluginsImpl.cc index 83b132ea..273c172c 100644 --- a/snapper/PluginsImpl.cc +++ b/snapper/PluginsImpl.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2011-2015] Novell, Inc. - * Copyright (c) [2022-2023] SUSE LLC + * Copyright (c) [2022-2025] SUSE LLC * * All Rights Reserved. * @@ -23,6 +23,8 @@ #include "config.h" +#include + #include "snapper/FileUtils.h" #include "snapper/Filesystem.h" #include "snapper/PluginsImpl.h" @@ -30,6 +32,7 @@ #include "snapper/SnapperDefines.h" #include "snapper/Exception.h" #include "snapper/Snapshot.h" +#include "snapper/Log.h" namespace snapper @@ -57,10 +60,25 @@ namespace snapper for (const string& script : scripts) { string fullname = dir.fullname(script); + SystemCmd::Args cmd_args = { fullname }; cmd_args << args; SystemCmd cmd(cmd_args); + report.entries.emplace_back(fullname, args, cmd.retcode()); + + y2mil("result of " << fullname << " " << boost::join(args, " ")); + + for (const string& line : cmd.get_stdout()) + y2mil("stdout: " << line); + + for (const string& line : cmd.get_stderr()) + y2mil("stderr: " << line); + + if (cmd.retcode() != 0) + y2err("return code: " << cmd.retcode()); + else + y2mil("return code: " << cmd.retcode()); } } catch (const Exception& e)