shieldLog function

void shieldLog(
  1. String message, {
  2. String level = 'INFO',
  3. String? tag,
})

Sanitizes PII from message and logs it with a level and optional tag.

Drop-in replacement for structured logging.

shieldLog('User email: john@test.com');
// Output: [INFO] User email: [EMAIL HIDDEN]

shieldLog('Auth failed', level: 'ERROR', tag: 'auth');
// Output: [ERROR] [auth] Auth failed

Implementation

void shieldLog(String message, {String level = 'INFO', String? tag}) {
  LogShield().log(message, level: level, tag: tag);
}