Definition at line 86 of file progress_indicator.h.
#include <progress_indicator.h>
◆ json_logger_progress_indicator()
clanguml::common::generators::json_logger_progress_indicator::json_logger_progress_indicator |
( |
| ) |
|
|
default |
◆ ~json_logger_progress_indicator()
clanguml::common::generators::json_logger_progress_indicator::~json_logger_progress_indicator |
( |
| ) |
|
|
overridedefault |
◆ add_progress_bar()
void clanguml::common::generators::json_logger_progress_indicator::add_progress_bar |
( |
const std::string & |
name, |
|
|
size_t |
max, |
|
|
indicators::Color |
color |
|
) |
| |
|
overridevirtual |
Add a new progress bar to the indicator set
- Parameters
-
name | Name (prefix) of the progress bar |
max | Total number of steps in the progress bar |
color | Color of the progress bar |
Implements clanguml::common::generators::progress_indicator_base.
Definition at line 37 of file progress_indicator.cc.
39{
40 inja::json j;
41 j["diagram_name"] = name;
42 j["max"] = max;
43 j["progress"] = 0;
44 j["status"] = "started";
45
46 progress_bars_mutex_.lock();
47
48 progress_bar_index_.emplace(name, progress_state{0, 0, max});
49
50 progress_bars_mutex_.unlock();
51
52 spdlog::get("json-progress-logger")
53 ->log(spdlog::level::info, "{}", j.dump());
54}
◆ complete()
void clanguml::common::generators::json_logger_progress_indicator::complete |
( |
const std::string & |
name | ) |
|
|
overridevirtual |
Set specified progress bar as complete.
- Parameters
-
name | Name of the progress bar |
Implements clanguml::common::generators::progress_indicator_base.
Definition at line 149 of file progress_indicator.cc.
150{
151 inja::json j;
152 j["diagram_name"] = name;
153
154 progress_bars_mutex_.lock();
155
156 if (progress_bar_index_.count(name) == 0) {
157 progress_bars_mutex_.unlock();
158 return;
159 }
160
161 auto &p = progress_bar_index_.at(name);
162
163 p.progress = p.max;
164
165 j["progress"] = p.progress;
166 j["max"] = p.max;
167 j["status"] = "completed";
168
169 progress_bars_mutex_.unlock();
170
171 spdlog::get("json-progress-logger")
172 ->log(spdlog::level::info, "{}", j.dump());
173}
◆ fail()
void clanguml::common::generators::json_logger_progress_indicator::fail |
( |
const std::string & |
name | ) |
|
|
overridevirtual |
Set progress bar as failed.
- Parameters
-
name | Name of the progress bar |
Implements clanguml::common::generators::progress_indicator_base.
Definition at line 206 of file progress_indicator.cc.
207{
208 inja::json j;
209 j["diagram_name"] = name;
210
211 progress_bars_mutex_.lock();
212
213 if (progress_bar_index_.count(name) == 0) {
214 progress_bars_mutex_.unlock();
215 return;
216 }
217 auto &p = progress_bar_index_.at(name);
218
219 j["progress"] = p.progress;
220 j["max"] = p.max;
221 j["status"] = "failed";
222
223 progress_bars_mutex_.unlock();
224
225 spdlog::get("json-progress-logger")
226 ->log(spdlog::level::err, "{}", j.dump());
227}
◆ increment()
void clanguml::common::generators::json_logger_progress_indicator::increment |
( |
const std::string & |
name | ) |
|
|
overridevirtual |
Increment specified progress bar.
- Parameters
-
name | Name of the progress bar |
Implements clanguml::common::generators::progress_indicator_base.
Definition at line 89 of file progress_indicator.cc.
90{
91 inja::json j;
92 j["diagram_name"] = name;
93
94 progress_bars_mutex_.lock();
95
96 if (progress_bar_index_.count(name) == 0) {
97 progress_bars_mutex_.unlock();
98 return;
99 }
100
101 auto &p = progress_bar_index_.at(name);
102
103 j["progress"] = p.progress;
104 j["max"] = p.max;
105 j["status"] = "ongoing";
106
107 p.progress++;
108
109 progress_bars_mutex_.unlock();
110
111 spdlog::get("json-progress-logger")
112 ->log(spdlog::level::info, "{}", j.dump());
113}
◆ stop()
void clanguml::common::generators::json_logger_progress_indicator::stop |
( |
| ) |
|
|
inlineoverridevirtual |
The documentation for this class was generated from the following files: