m8ty_client_logging
Logging information service cover all the aspects of bank documents, attachments and categories.
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';
How to perform different tasks
Here some examples how the dart client can be used
Send a log entry to the server
// Set Api key
final loggingClient = M8tyClientLogging();
loggingClient.setApiKey(m8tyApiKeyAuth, "myApiKey");
// create instance of the API
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);
Last modified: 06 January 2025