v2.0.4: Enhance LogInterceptor with callback support

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-06-01 17:38:43 +02:00
parent 90146653d0
commit fe42eac0dc
5 changed files with 46 additions and 24 deletions
+9 -7
View File
@@ -23,6 +23,14 @@ Future<void> main() async {
final DebugPrint debugPrintInterface = DebugPrint();
final DebugAuthInterface debugAuthInterface = DebugAuthInterface();
LogEvent? skipDebugPrintWhenDisabled(
LogEvent event, LogInterceptorContext context) {
if (context.interface is DebugPrint && Feature.logging.disabled) {
return null;
}
return event;
}
// If any Feature enum items are `enabledAtStartup`, enable them within Arcane.
for (final Feature feature in Feature.values) {
@@ -33,13 +41,7 @@ Future<void> main() async {
await Arcane.logger.registerInterface(
debugPrintInterface,
interceptors: [
LogInterceptor((event, context) {
if (context.interface is DebugPrint && Feature.logging.disabled) {
return null;
}
return event;
}),
LogInterceptor(skipDebugPrintWhenDisabled),
],
);