diff options
| author | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
| commit | 0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch) | |
| tree | 94730e7594fd09ae1fa820391ce311f6daf13905 /src/zenremotestore/operationlogoutput.cpp | |
| parent | Fix forward declaration order for s_GotSigWinch and SigWinchHandler (diff) | |
| parent | trace: declare Region event name fields as AnsiString (#1012) (diff) | |
| download | archived-zen-sb/zen-help.tar.xz archived-zen-sb/zen-help.zip | |
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher
- Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'src/zenremotestore/operationlogoutput.cpp')
| -rw-r--r-- | src/zenremotestore/operationlogoutput.cpp | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/zenremotestore/operationlogoutput.cpp b/src/zenremotestore/operationlogoutput.cpp deleted file mode 100644 index 5ed844c9d..000000000 --- a/src/zenremotestore/operationlogoutput.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#include <zenremotestore/operationlogoutput.h> - -#include <zencore/logging.h> -#include <zencore/logging/logger.h> - -ZEN_THIRD_PARTY_INCLUDES_START -#include <gsl/gsl-lite.hpp> -ZEN_THIRD_PARTY_INCLUDES_END - -namespace zen { - -class StandardLogOutput; - -class StandardLogOutputProgressBar : public OperationLogOutput::ProgressBar -{ -public: - StandardLogOutputProgressBar(StandardLogOutput& Output, std::string_view InSubTask) : m_Output(Output), m_SubTask(InSubTask) {} - - virtual void UpdateState(const State& NewState, bool DoLinebreak) override; - virtual void Finish() override; - -private: - StandardLogOutput& m_Output; - std::string m_SubTask; - State m_State; -}; - -class StandardLogOutput : public OperationLogOutput -{ -public: - StandardLogOutput(LoggerRef& Log) : m_Log(Log) {} - virtual void EmitLogMessage(const logging::LogPoint& Point, fmt::format_args Args) override - { - if (m_Log.ShouldLog(Point.Level)) - { - m_Log->Log(Point, Args); - } - } - - virtual void SetLogOperationName(std::string_view Name) override - { - m_LogOperationName = Name; - ZEN_OPERATION_LOG_INFO(*this, "{}", m_LogOperationName); - } - virtual void SetLogOperationProgress(uint32_t StepIndex, uint32_t StepCount) override - { - [[maybe_unused]] const size_t PercentDone = StepCount > 0u ? gsl::narrow<uint8_t>((100 * StepIndex) / StepCount) : 0u; - ZEN_OPERATION_LOG_INFO(*this, "{}: {}%", m_LogOperationName, PercentDone); - } - virtual uint32_t GetProgressUpdateDelayMS() override { return 2000; } - virtual ProgressBar* CreateProgressBar(std::string_view InSubTask) override - { - return new StandardLogOutputProgressBar(*this, InSubTask); - } - -private: - LoggerRef m_Log; - std::string m_LogOperationName; - LoggerRef Log() { return m_Log; } -}; - -void -StandardLogOutputProgressBar::UpdateState(const State& NewState, bool DoLinebreak) -{ - ZEN_UNUSED(DoLinebreak); - [[maybe_unused]] const size_t PercentDone = - NewState.TotalCount > 0u ? gsl::narrow<uint8_t>((100 * (NewState.TotalCount - NewState.RemainingCount)) / NewState.TotalCount) : 0u; - std::string Task = NewState.Task; - switch (NewState.Status) - { - case State::EStatus::Aborted: - Task = "Aborting"; - break; - case State::EStatus::Paused: - Task = "Paused"; - break; - default: - break; - } - ZEN_OPERATION_LOG_INFO(m_Output, "{}: {}%{}", Task, PercentDone, NewState.Details.empty() ? "" : fmt::format(" {}", NewState.Details)); - m_State = NewState; -} -void -StandardLogOutputProgressBar::Finish() -{ - if (m_State.RemainingCount > 0) - { - State NewState = m_State; - NewState.RemainingCount = 0; - NewState.Details = ""; - UpdateState(NewState, /*DoLinebreak*/ true); - } -} - -OperationLogOutput* -CreateStandardLogOutput(LoggerRef Log) -{ - return new StandardLogOutput(Log); -} - -} // namespace zen |