From fc571a7d4a72bc98008de0f3418c506afda3c690 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Fri, 18 Jul 2025 09:53:54 +0200 Subject: [PATCH] - nicer format for logging output of plugins --- snapper/PluginsImpl.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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) -- 2.47.3