StormByte C++ Library: Logger module 1.2.0
StormByte-Logger is the logging module of the StormByte C++ suite.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
StormByte::Logger::RedactManip Struct Reference

Stateful redaction manipulator. More...

#include <StormByte/logger/manipulators.hxx>

Public Member Functions

constexpr RedactManip operator() (std::size_t n) const noexcept
 Build a manipulator that keeps the last n characters visible.
 

Public Attributes

std::size_t count = 0
 0 = mask all; N = keep N characters
 
bool keep_first = false
 true = keep first N, false = keep last N characters
 

Detailed Description

Stateful redaction manipulator.

Applies to both text and numbers (numbers are converted to string first). Remains active until noredact.

Usage:

log << redact << secret << std::endl; // full mask
log << redact(4) << token << std::endl; // keep last 4
log << redact_first(4) << token << std::endl; // keep first 4
log << noredact << plain << std::endl;
Log & noredact(Log &log) noexcept
Disable redaction until the next redact / redact(n) / redact_first(n).
constexpr RedactManip redact_first(std::size_t n) noexcept
Build a manipulator that keeps the first n characters visible.
Definition manipulators.hxx:231
constexpr RedactManip redact
Full redaction manipulator (mask everything).
Definition manipulators.hxx:224

Member Function Documentation

◆ operator()()

constexpr RedactManip StormByte::Logger::RedactManip::operator() ( std::size_t  n) const
inlineconstexprnoexcept

Build a manipulator that keeps the last n characters visible.

Parameters
nNumber of trailing characters to keep unmasked.
Returns
A new RedactManip configured for keep-last.

Member Data Documentation

◆ count

std::size_t StormByte::Logger::RedactManip::count = 0

0 = mask all; N = keep N characters

◆ keep_first

bool StormByte::Logger::RedactManip::keep_first = false

true = keep first N, false = keep last N characters


The documentation for this struct was generated from the following file: