platform/sandbox/mqueue/example/routing/logger.dart
2024-11-12 01:00:05 -07:00

21 lines
407 B
Dart

import 'package:angel3_mq/mq.dart';
final class Logger with ProducerMixin {
Logger() {
MQClient.instance.declareExchange(
exchangeName: 'logs',
exchangeType: ExchangeType.direct,
);
}
Future<void> log({
required String level,
required String message,
}) async {
sendMessage(
payload: message,
exchangeName: 'logs',
routingKey: level,
);
}
}