# # # patch "constants.hh" # from [1eff8ec9e2bbfd15464429ff5a88ffc475579328] # to [d0a7820dda371e19f30b83adcd1d6c5027ebfcd8] # # patch "database.cc" # from [0e1f55722ce271ec5d6f01515d4a0969551beae9] # to [ad4bcf46d4171450aca5c7767bb8732b23e3c72d] # ============================================================ --- constants.hh 1eff8ec9e2bbfd15464429ff5a88ffc475579328 +++ constants.hh d0a7820dda371e19f30b83adcd1d6c5027ebfcd8 @@ -50,7 +50,7 @@ namespace constants // size of a line of database traffic logging, beyond which lines will be // truncated. - std::size_t const db_log_line_sz = 70; + std::size_t const db_log_line_sz = 50; // maximum size in bytes of the database xdelta version reconstruction // cache. the value of 7 MB was determined as the optimal point after ============================================================ --- database.cc 0e1f55722ce271ec5d6f01515d4a0969551beae9 +++ database.cc ad4bcf46d4171450aca5c7767bb8732b23e3c72d @@ -1063,24 +1063,19 @@ database_impl::fetch(results & res, // profiling finds this logging to be quite expensive if (global_sanity.debug_p()) { - string log; - switch (query.args[param-1].type) - { // FIXME: this is somewhat ugly... - case query_param::text: - log = query.args[param-1].data; - if (log.size() > constants::log_line_sz) - log = log.substr(0, constants::log_line_sz); - L(FL("binding %d with value '%s'") % param % log); - break; - case query_param::blob: - log = encode_hexenc(query.args[param-1].data); - if (log.size() > constants::log_line_sz) - log = log.substr(0, constants::log_line_sz); - L(FL("binding %d with value x'%s'") % param % log); - break; - default: - L(FL("binding %d with unknown type") % param); + string prefix; + string log(query.args[param-1].data); + + if (query.args[param-1].type == query_param::blob) + { + prefix = "x"; + log = encode_hexenc(log); } + + if (log.size() > constants::db_log_line_sz) + log = log.substr(0, constants::db_log_line_sz - 2) + ".."; + + L(FL("binding %d with value '%s'") % param % log); } switch (idx(query.args, param - 1).type)