StripeKit 0.1.1
Stripe integration toolkit for C++
Loading...
Searching...
No Matches

Routing StripeKit's diagnostics into the host application's log, with helpers for keeping secrets out of log output. More...

Collaboration diagram for Logging:

Classes

struct  stripekit::LogContext
 Extra identifiers attached to a log entry. More...
class  stripekit::Logger
 Receives StripeKit's log entries. More...
class  stripekit::NullLogger
 A logger that discards everything. More...
class  stripekit::ConsoleLogger
 A logger that writes to the process's standard error stream. More...

Enumerations

enum class  stripekit::LogLevel {
  stripekit::LogLevel::Trace , stripekit::LogLevel::Debug , stripekit::LogLevel::Info , stripekit::LogLevel::Warn ,
  stripekit::LogLevel::Error , stripekit::LogLevel::Off
}
 Severity of a log entry. More...

Functions

bool stripekit::is_sensitive_field_name (std::string_view field_name)
 Reports whether a field is one whose value should never be logged.
std::string stripekit::redact_sensitive_value (std::string_view value)
 Replaces a secret value with a placeholder.
std::string stripekit::redact_sensitive_text (std::string_view text)
 Strips secret-looking tokens out of free-form text.

Detailed Description

Routing StripeKit's diagnostics into the host application's log, with helpers for keeping secrets out of log output.

Enumeration Type Documentation

◆ LogLevel

enum class stripekit::LogLevel
strong

Severity of a log entry.

Enumerator
Trace 

Very detailed tracing.

Noisy.

Debug 

Diagnostic detail useful while developing.

Info 

Normal, noteworthy activity.

Warn 

Something unexpected that did not stop the operation.

Error 

An operation failed.

Off 

Nothing at all.

Use as a threshold to silence logging.

Definition at line 26 of file Logging.h.

Function Documentation

◆ is_sensitive_field_name()

bool stripekit::is_sensitive_field_name ( std::string_view field_name)

Reports whether a field is one whose value should never be logged.

Recognises the names Stripe uses for keys, secrets, and card details.

Parameters
field_nameName of the field being considered.
Returns
True when the value should be replaced before logging.

◆ redact_sensitive_value()

std::string stripekit::redact_sensitive_value ( std::string_view value)

Replaces a secret value with a placeholder.

Parameters
valueThe value to hide.
Returns
A placeholder that shows something was present without revealing it.

◆ redact_sensitive_text()

std::string stripekit::redact_sensitive_text ( std::string_view text)

Strips secret-looking tokens out of free-form text.

Catches API keys and signing secrets by their recognisable prefixes, which makes it useful for sanitising an error message or a response body before writing it to a log.

Parameters
textThe text to sanitise.
Returns
The text with recognised secrets replaced by placeholders.