addAttribute method

void addAttribute(
  1. String key,
  2. Object value
)

Add a custom attribute to all future logs sent by all loggers.

Values can be nested up to 10 levels deep. Keys using more than 10 levels will be sanitized by SDK.

All values must be supported by StandardMessageCodec.

Implementation

void addAttribute(String key, Object value) {
  wrap('logs.addGlobalAttribute', core.internalLogger, {'value': value}, () {
    return _platform.addGlobalAttribute(key, value);
  });
}