<commit_before>#include "JsonFile.hpp"
#include "Common/toJson.hpp"

using json = nlohmann::json;

namespace But
{
namespace Log
{
namespace Destination
{

void JsonFile::toStreamFormat(std::ostream& os, Backend::Entry const& entry)
{
  auto tab = Common::toJson(entry);
  os << tab << "\n";
}


void JsonFile::toStreamFormat(std::ostream& os, Field::FormattedString const& str, Backend::Entry const& entry)
{
  auto tab = json::array();
  tab.push_back( Common::toJsonField( Backend::FieldInfo{str} ) );
  Common::toJson(tab, entry);
  os << tab << "\n";
}

}
}
}<commit_msg>implementation moved to new helper<commit_after>#include "JsonFile.hpp"
#include "Common/toJsonStream.hpp"

namespace But
{
namespace Log
{
namespace Destination
{

void JsonFile::toStreamFormat(std::ostream& os, Backend::Entry const& entry)
{
  Common::toJsonStream(os, entry);
  os << endline();
}


void JsonFile::toStreamFormat(std::ostream& os, Field::FormattedString const& str, Backend::Entry const& entry)
{
  Common::toJsonStream(os, str, entry);
  os << endline();
}

}
}
}
{'fraction_non_alphanumeric': 0.15958451369216242, 'fraction_numerical': 0.0, 'mean_word_length': 5.928104575163399, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4921921', 'n_tokens_mistral': 367, 'n_tokens_neox': 362, 'n_words': 83}