Class LogMask

java.lang.Object
io.karatelabs.output.LogMask

public class LogMask extends Object
Declarative HTTP log masking. Applied by HttpLogger when formatting request / response payloads for the report buffer and the console.

Constructed from the map shape stored under configure logging = { mask: {...} }:

 mask: {
   headers:     ['Authorization', 'Cookie'],     // matched case-insensitively
   jsonPaths:   ['$.password', '$.token'],       // simple "$.x.y" / "$..x" paths
   patterns:    [{ regex: '\\bBearer ...', replacement: 'Bearer ***' }],
   replacement: '***',                           // default for headers / jsonPaths
   enableForUri: function(uri) { return !uri.contains('/health') }   // optional gate
 }
 
  • Method Details

    • fromMap

      public static LogMask fromMap(Map<String,Object> map)
    • describe

      public String describe()
      One-line description of mask rule counts, e.g. "3 headers, 2 jsonPaths, 1 pattern". Used by the per-scenario "mask active" debug log so users can verify their config compiled.
    • enabledForUri

      public boolean enabledForUri(String uri)
    • isHeaderMasked

      public boolean isHeaderMasked(String headerName)
    • maskHeader

      public String maskHeader(String name, String value)
    • maskBody

      public String maskBody(String body)