Skip to content

Commit 77d78e9

Browse files
committed
JSONStateReader: Do not emit json Null/Nan/Inf warnings with Quiet verbosity
1 parent 050f243 commit 77d78e9

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/flamegpu/io/JSONStateReader.cu

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,17 @@ class JSONStateReader_impl : public nlohmann::json_sax<nlohmann::json> {
219219
mode.pop();
220220
is_array = true;
221221
}
222-
if (mode.top() == Environment) {
223-
fprintf(stderr, "Warning: JSON Environment property '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", lastKey.c_str());
224-
} else if (mode.top() == MacroEnvironment) {
225-
fprintf(stderr, "Warning: JSON MacroEnvironment property '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", lastKey.c_str());
226-
} else if (mode.top() == AgentInstance) {
227-
fprintf(stderr, "Warning: JSON Agent '%s' variable '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", current_agent.c_str(), lastKey.c_str());
228-
} else {
229-
fprintf(stderr, "Warning: JSON state item '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", lastKey.c_str());
222+
// Emit a warning if the verbosity level is high enough
223+
if (verbosity > Verbosity::Quiet) {
224+
if (mode.top() == Environment) {
225+
fprintf(stderr, "Warning: JSON Environment property '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", lastKey.c_str());
226+
} else if (mode.top() == MacroEnvironment) {
227+
fprintf(stderr, "Warning: JSON MacroEnvironment property '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", lastKey.c_str());
228+
} else if (mode.top() == AgentInstance) {
229+
fprintf(stderr, "Warning: JSON Agent '%s' variable '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", current_agent.c_str(), lastKey.c_str());
230+
} else {
231+
fprintf(stderr, "Warning: JSON state item '%s' contains NULL, this has been interpreted as NaN (but may represent Inf).\n", lastKey.c_str());
232+
}
230233
}
231234
if (is_array) {
232235
mode.push(VariableArray);

0 commit comments

Comments
 (0)