mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2024-12-27 21:35:41 +00:00
Log raw pastie from POST and pastie before going to redis.
This is to hopefully track down the pastie corruption bug that I'm only encountering on the outgoing server.
This commit is contained in:
parent
b5b0db8b8d
commit
5f0ea56241
2 changed files with 20 additions and 0 deletions
|
@ -20,6 +20,10 @@
|
|||
#include "split_get_vars.hpp"
|
||||
#include "escapist.hpp"
|
||||
#include "sanitized_utf8.hpp"
|
||||
#include "spdlog.hpp"
|
||||
#if defined(SPDLOG_DEBUG_ON)
|
||||
# include "truncated_string.hpp"
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
@ -80,6 +84,11 @@ namespace tawashi {
|
|||
original_data = read_n(parSrc, input_len);
|
||||
Escapist houdini;
|
||||
for (auto& itm : split_env_vars(original_data)) {
|
||||
#if defined(SPDLOG_DEBUG_ON)
|
||||
if (itm.first == "pastie") {
|
||||
spdlog::get("statuslog")->debug("Raw pastie from POST, size={}: \"{}\"", itm.second.size(), truncated_string(itm.second, 30));
|
||||
}
|
||||
#endif
|
||||
std::string key(houdini.unescape_url(itm.first));
|
||||
std::string val(houdini.unescape_url(itm.second));
|
||||
map[std::move(key)] = std::move(val);
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
#include "tawashi_config.h"
|
||||
#include "duckhandy/stringize.h"
|
||||
#include "spdlog.hpp"
|
||||
#include "truncated_string.hpp"
|
||||
#include <cassert>
|
||||
#include <ciso646>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
namespace tawashi {
|
||||
namespace {
|
||||
|
@ -104,6 +106,15 @@ namespace tawashi {
|
|||
return make_submission_result(ErrorReasons::UserFlooding);
|
||||
}
|
||||
|
||||
auto statuslog = spdlog::get("statuslog");
|
||||
if (statuslog->should_log(spdlog::level::info)) {
|
||||
statuslog->info(
|
||||
"Submitting pastie of size {} to redis -> \"{}\"",
|
||||
parText.size(),
|
||||
truncated_string(parText, 30)
|
||||
);
|
||||
}
|
||||
|
||||
const auto next_id = redis.incr("paste_counter");
|
||||
std::string token = num_to_token(next_id);
|
||||
assert(not token.empty());
|
||||
|
|
Loading…
Reference in a new issue