Skip to content

Commit

Permalink
chore: remove useless logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shdwmtr committed Jul 21, 2024
1 parent 0606641 commit 2efe5a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/core/py_controller/co_spawn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ PythonManager::PythonManager() : m_InterpreterThreadSave(nullptr)
this->m_instanceCount = 0;

// initialize global modules
Logger.LogItem("+", "Redirecting Standard Output..."); PyImport_AppendInittab("hook_stdout", &PyInit_CustomStdout);
Logger.LogItem("+", "Redirecting Standard Error..."); PyImport_AppendInittab("hook_stderr", &PyInit_CustomStderr);
Logger.LogItem("+", "Inserting PluginUtils..."); PyImport_AppendInittab("PluginUtils", &PyInit_Logger);
Logger.LogItem("+", "Inserting Millennium..."); PyImport_AppendInittab("Millennium", &PyInit_Millennium);
PyImport_AppendInittab("hook_stdout", &PyInit_CustomStdout);
PyImport_AppendInittab("hook_stderr", &PyInit_CustomStderr);
PyImport_AppendInittab("PluginUtils", &PyInit_Logger);
PyImport_AppendInittab("Millennium", &PyInit_Millennium);

Logger.LogItem("Python", "Initializing Python...");

Expand Down
22 changes: 9 additions & 13 deletions src/git/git.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace Dependencies {
{
if (refCallbackIsMerge)
{
Logger.LogItem("Head", "Found merge reference...");
git_oid_cpy((git_oid *)payload, oid);
}
return 0;
Expand All @@ -35,7 +34,7 @@ namespace Dependencies {
if (std::filesystem::exists(packageLocalPath) && !std::filesystem::is_empty(packageLocalPath))
{
std::uintmax_t removedCount = std::filesystem::remove_all(packageLocalPath);
Logger.LogItem("Status", fmt::format("Flushed {} items", removedCount));
Logger.LogItem("+", fmt::format("Flushed {} items", removedCount));
}
else if (!std::filesystem::exists(packageLocalPath))
{
Expand All @@ -50,18 +49,18 @@ namespace Dependencies {
}
else
{
Logger.LogItem("Status", "Ready to clone module...");
Logger.LogItem("+", "Ready to clone module...");
}

Logger.LogItem("status", "Cloning modules...");
Logger.LogItem("+", "Cloning modules...");
int cloneSuccessStatus = git_clone(&repository, remoteObject.c_str(), packageLocalPath.c_str(), &gitCloneOpts);

if (cloneSuccessStatus != 0)
{
const git_error* lastError = git_error_last();
const std::string strErrorMessage = fmt::format("Error cloning frontend modules -> {}", lastError->message);

Logger.LogItem("Status", strErrorMessage, true);
Logger.LogItem("+", strErrorMessage, true);
boxer::show(strErrorMessage.c_str(), "Fatal Error", boxer::Style::Error);
}

Expand All @@ -73,7 +72,7 @@ namespace Dependencies {
int gitErrorCode;
git_remote *remote;

Logger.LogItem("Status", "Checking for updates...");
Logger.LogItem("+", "Checking for updates...");
gitErrorCode = git_remote_lookup(&remote, repo, "origin");

if (gitErrorCode < 0)
Expand Down Expand Up @@ -113,7 +112,6 @@ namespace Dependencies {
git_merge_analysis_t analysisOut;
git_merge_preference_t preferenceOut;

Logger.LogItem("Status", "Analyzing repository information...");
gitErrorCode = git_merge_analysis(&analysisOut, &preferenceOut, repo, (const git_annotated_commit **) annotatedCommit, 1);

if (gitErrorCode < 0)
Expand All @@ -124,7 +122,7 @@ namespace Dependencies {

if (analysisOut & GIT_MERGE_ANALYSIS_UP_TO_DATE)
{
Logger.LogItem("Status", "Repository is up to date.");
Logger.LogItem("+", "Repository is up to date.");

git_annotated_commit_free(annotatedCommit[0]);
git_repository_state_cleanup(repo);
Expand All @@ -134,7 +132,7 @@ namespace Dependencies {
}
else if (analysisOut & GIT_MERGE_ANALYSIS_FASTFORWARD)
{
Logger.LogItem("Status", "Fast-forwarding analysis...");
Logger.LogItem("+", "Fast-forwarding analysis...");

git_reference *referenceOut;
git_reference *newTargetReference;
Expand Down Expand Up @@ -172,21 +170,19 @@ namespace Dependencies {
git_libgit2_init();

Logger.LogHead(fmt::format("Package Manager - {} [{} ms]", common_name, duration_cast<milliseconds>(steady_clock::now() - startTime).count()));
Logger.LogItem("Path", package_path);

git_repository* repo = nullptr;
int repositoryOpenStatus = git_repository_open(&repo, package_path.c_str());

switch (repositoryOpenStatus) {
case GIT_ENOTFOUND:
{
Logger.LogItem("Status", "Repository was not found...");
Logger.LogItem("+", "Repository was not found...");
repositoryOpenStatus = CloneRepository(repo, package_path, remote_object);
break;
}
case 0: // no error occured
{
Logger.LogItem("Status", "Fetching repository head...");
repositoryOpenStatus = FetchHead(repo, package_path);
break;
}
Expand All @@ -196,7 +192,7 @@ namespace Dependencies {
}
}

Logger.LogItem("Status", fmt::format("{} in {} ms", repositoryOpenStatus == 0 ? "Succeeded" : "Failed", duration_cast<milliseconds>(steady_clock::now() - startTime).count()), true);
Logger.LogItem("+", fmt::format("{} in {} ms", repositoryOpenStatus == 0 ? "Succeeded" : "Failed", duration_cast<milliseconds>(steady_clock::now() - startTime).count()), true);
// Free resources
git_repository_free(repo);
git_libgit2_shutdown();
Expand Down

0 comments on commit 2efe5a7

Please sign in to comment.