Streaming JSON masking for bounded log output.
Definition in file masking.hpp.
Go to the source code of this file.
#include <cstddef>#include <memory>#include <string>#include <string_view>#include <vector>Classes | |
| class | formats::json::MaskingRules |
| Immutable compiled masking rules, cheaply copyable and safe to share. A whole segment "*" matches any member name unless an exact child exists. Exact and wildcard branches are not merged or retried on a later mismatch. An empty path selects the root. Empty blacklists preserve everything; empty whitelists mask everything. Incomplete whitelist paths hide scalars. More... | |
| struct | formats::json::MaskedJson |
| Masked JSON or its UTF-8-safe prefix when the output budget is reached. More... | |
Namespaces | |
| namespace | formats |
| Value formats representation, parsing and serialization. | |
| namespace | formats::json |
| JSON support. | |
Typedefs | |
| using | formats::json::MaskingPath = std::vector<std::string> |
| A sequence of object member names. Arrays do not consume a segment. | |
Enumerations | |
| enum class | formats::json::MaskingListMode { formats::json::kBlacklist , formats::json::kWhitelist } |
| Whether paths select hidden or visible subtrees. More... | |
Functions | |
| MaskedJson | formats::json::MaskJson (std::string_view input, const MaskingRules &rules, std::size_t log_limit) |
Mask JSON using RapidJSON streaming parsing and serialization. Scalars become "...", objects "{...}", and arrays "[...]". Output is compact JSON until log_limit bytes are produced; then parsing stops and the result may be incomplete JSON. No suffix is added. Reaching the budget, even exactly, sets formats::json::MaskedJson::limit_reached; the unread input suffix is not validated. A zero budget skips parsing. A single input token may be fully decoded before its SAX callback runs. | |