asString method

String asString(
  1. TraceIdRepresentation representation
)

Implementation

String asString(TraceIdRepresentation representation) {
  switch (representation) {
    case TraceIdRepresentation.decimal:
      return value.toString();
    case TraceIdRepresentation.hex:
      return value.toRadixString(16);
    case TraceIdRepresentation.hex16Chars:
      return value.toRadixString(16).toUpperCase().padLeft(16, '0');
    case TraceIdRepresentation.hex32Chars:
      return value.toRadixString(16).toUpperCase().padLeft(32, '0');
  }
}