mirror of
https://github.com/hanskokx/arcane_framework.git
synced 2026-08-12 06:10:55 +02:00
v2.0.4: Enhance LogInterceptor with callback support
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -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),
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user