diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-08-07 20:09:39 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-08-07 20:09:39 +0100 |
commit | 23d4bd86c9eb58b3049ff4c14fd31d4625f64a2a (patch) | |
tree | 96c7aa17ce74d8a967f1061baf6da786f97dc259 /gentoobrowse-api/service/utils | |
parent | Tidier git pointer typedefs (diff) | |
download | gentoobrowse-api-23d4bd86c9eb58b3049ff4c14fd31d4625f64a2a.tar.bz2 gentoobrowse-api-23d4bd86c9eb58b3049ff4c14fd31d4625f64a2a.tar.xz gentoobrowse-api-23d4bd86c9eb58b3049ff4c14fd31d4625f64a2a.zip |
Switch to IceTray loggers
Some tidyup probably required
Diffstat (limited to 'gentoobrowse-api/service/utils')
-rw-r--r-- | gentoobrowse-api/service/utils/git.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gentoobrowse-api/service/utils/git.cpp b/gentoobrowse-api/service/utils/git.cpp index 9a1cae2..450bfec 100644 --- a/gentoobrowse-api/service/utils/git.cpp +++ b/gentoobrowse-api/service/utils/git.cpp @@ -2,6 +2,7 @@ #include <maintenance.h> #include <execinfo.h> #include <compileTimeFormatter.h> +#include <logger.h> namespace Gentoo { namespace Utils { @@ -46,11 +47,12 @@ namespace Gentoo { return gitSafeGet(git_annotated_commit_from_revspec, git_annotated_commit_free, repo, "FETCH_HEAD"); } - AdHocFormatter(FastForward, "Performing fast-forward %? -> %?\n"); - AdHocFormatter(CheckOut, "Checking out %?\n"); + AdHocFormatter(FastForward, "Performing fast-forward %? -> %?"); + AdHocFormatter(CheckOut, "Checking out %?"); git_oid gitFastForward(git_repository * repo, const git_annotated_commit * fetch_head) { + auto log = LOGMANAGER()->getLogger(__FUNCTION__); // Test fast-forward is possible const git_annotated_commit * heads[] = { fetch_head }; git_merge_analysis_t analysis = GIT_MERGE_ANALYSIS_NONE; @@ -68,28 +70,29 @@ namespace Gentoo { // Perform fast-forward auto fetch_head_id = *git_annotated_commit_id(fetch_head); auto fetch_head_object = gitSafeGet(git_object_lookup, git_object_free, repo, &fetch_head_id, GIT_OBJ_ANY); - FastForward::write(std::cerr, *git_reference_target(head.get()), fetch_head_id); + log->messagectf<FastForward>(IceTray::Logging::LogLevel::INFO, *git_reference_target(head.get()), fetch_head_id); gitSafeGet(git_reference_set_target, git_reference_free, head.get(), &fetch_head_id, "fast-forward"); // Checkout new head - CheckOut::write(std::cerr, fetch_head_id); + log->messagectf<CheckOut>(IceTray::Logging::LogLevel::INFO, fetch_head_id); auto checkout_options = gitSafeGet(git_checkout_init_options, 0u + GIT_CHECKOUT_OPTIONS_VERSION); checkout_options.checkout_strategy = GIT_CHECKOUT_FORCE; gitSafe(git_checkout_head, repo, &checkout_options); return fetch_head_id; } - AdHocFormatter(Updating, "Updating repository in %? from %?/%?\n"); - AdHocFormatter(UpdateComplete, "Update complete to %?\n"); + AdHocFormatter(Updating, "Updating repository in %? from %?/%?"); + AdHocFormatter(UpdateComplete, "Update complete to %?"); void updateRepository(const std::string & path, const std::string & upstream, const std::string & branch) { - Updating::write(std::cerr, path, upstream, branch); + auto log = LOGMANAGER()->getLogger(__FUNCTION__); + log->messagectf<Updating>(IceTray::Logging::LogLevel::INFO, path, upstream, branch); auto repo = gitSafeGet(git_repository_open, git_repository_free, path.c_str()); auto origin = gitSafeGet(git_remote_lookup, git_remote_free, repo.get(), upstream.c_str()); auto fetchHead = gitFetch(repo.get(), origin.get(), branch.c_str()); auto oid = gitFastForward(repo.get(), fetchHead.get()); - UpdateComplete::write(std::cerr, oid); + log->messagectf<UpdateComplete>(IceTray::Logging::LogLevel::INFO, oid); } } } |