MCPcopy Create free account
hub / github.com/apache/brpc / EscapeJson

Function EscapeJson

src/butil/logging.cc:951–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949}
950
951void EscapeJson(std::ostream& os, const butil::StringPiece& s) {
952 for (auto it = s.begin(); it != s.end(); it++) {
953 auto c = *it;
954 switch (c) {
955 case '"': os << "\\\""; break;
956 case '\\': os << "\\\\"; break;
957 case '\b': os << "\\b"; break;
958 case '\f': os << "\\f"; break;
959 case '\n': os << "\\n"; break;
960 case '\r': os << "\\r"; break;
961 case '\t': os << "\\t"; break;
962 default: os << c;
963 }
964 }
965}
966
967inline void OutputLog(std::ostream& os, const butil::StringPiece& s) {
968 if (FLAGS_escape_log) {

Callers 1

OutputLogFunction · 0.85

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected