Help Instance Help

m8ty_client_logging

Frontend logging client with support for plain and encrypted log submission.

Before you start

Check the documentation of the m8ty_client_logging library to get an idea about the available models and their properties.

Import all needed libraries

import 'package:dio/dio.dart'; import 'package:m8ty_client_logging/m8ty_client_logging.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';

Client Setup

final loggingClient = M8tyClientLogging(); loggingClient.setApiKey(m8tyApiKeyAuth, "myApiKey");

API Surface

LoggingApi

Method

Description

log

Frontend logging (plain text)

logEncrypted

Frontend logging (encrypted payload)

getPublicKey

Retrieve public key for encryption

How to perform different tasks

Here some examples how the dart client can be used

Send a log entry to the server

final loggingClient = M8tyClientLogging(); loggingClient.setApiKey(m8tyApiKeyAuth, "myApiKey"); final loggingApi = loggingClient.getLoggingApi(); final logEntry = LogEntryModel((b) => b ..severity = LogSeverityEnumModel.DEBUG ..message = "My log message" ..operation = "executePayment" ..metadata = MapBuilder({'deviceid': '1234', 'appVersion': '1.21'}) ..timestamp = DateTime.now().toUtc() ..resource = "instantpayment" ..stacktrace = StackTrace.current.toString() ..labels = BuiltList.of(['payment', "instant"]).toBuilder(), ); final loggingRequestModel = LoggingRequestModel( (b) => b..logs = BuiltList.of([logEntry]).toBuilder(), ); loggingApi.log(loggingRequestModel: loggingRequestModel);

Get public key for encrypted logging

final loggingClient = M8tyClientLogging(); loggingClient.setApiKey(m8tyApiKeyAuth, "myApiKey"); final loggingApi = loggingClient.getLoggingApi(); try { final response = await loggingApi.getPublicKey(); print('Public key: ${response.data}'); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }
03 June 2026