captureLog method

  1. @override
Future<void> captureLog({
  1. required String body,
  2. PostHogLogSeverity level = PostHogLogSeverity.info,
  3. Map<String, Object>? attributes,
  4. String? traceId,
  5. String? spanId,
  6. int? traceFlags,
})

Implementation

@override
Future<void> captureLog({
  required String body,
  PostHogLogSeverity level = PostHogLogSeverity.info,
  Map<String, Object>? attributes,
  String? traceId,
  String? spanId,
  int? traceFlags,
}) async {
  final normalizedAttributes =
      attributes != null ? PropertyNormalizer.normalize(attributes) : null;

  return handleWebMethodCall(
    MethodCall('captureLog', {
      'body': body,
      'level': level.name,
      if (normalizedAttributes != null) 'attributes': normalizedAttributes,
      if (traceId != null) 'traceId': traceId,
      if (spanId != null) 'spanId': spanId,
      // traceFlags 0 is meaningful (W3C sampled-false); only omit when null.
      if (traceFlags != null) 'traceFlags': traceFlags,
    }),
  );
}