Skip to content

Commit 4987e38

Browse files
committed
Restructured how warnings are logged by the JSONParser to allow them to be accumulated together and reported at once, or discarded if not required.
1 parent fc3fd40 commit 4987e38

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/vsg/io/JSONParser.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626
#include <vsg/core/Objects.h>
2727
#include <vsg/io/ReaderWriter.h>
2828
#include <vsg/io/mem_stream.h>
29+
#include <vsg/io/stream.h>
30+
31+
#include <list>
2932

3033
namespace vsg
3134
{
@@ -70,16 +73,13 @@ namespace vsg
7073
std::pair<std::size_t, std::size_t> lineAndColumnAtPosition(std::size_t position) const;
7174
std::string_view lineEnclosingPosition(std::size_t position) const;
7275

73-
Logger::Level level = Logger::LOGGER_WARN;
74-
uint32_t warningCount = 0;
76+
std::list<std::string> warnings;
7577

7678
template<typename... Args>
7779
void warning(Args&&... args)
7880
{
79-
++warningCount;
80-
8181
auto [line, column] = lineAndColumnAtPosition(pos);
82-
log(level, "Parsing error at [", line, ":", column, "], pos = ", pos, " [ ", lineEnclosingPosition(pos), " ]. ", std::forward<Args>(args)...);
82+
warnings.push_back(vsg::make_string("Parsing error at [", line, ":", column, "], pos = ", pos, " [ ", lineEnclosingPosition(pos), " ]. ", std::forward<Args>(args)...));
8383
}
8484

8585
inline bool white_space(char c) const

0 commit comments

Comments
 (0)