2022-12-10 12:11:46 -05:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:veilid/veilid.dart';
|
|
|
|
|
|
|
|
// Initialize Veilid
|
|
|
|
// Call only once.
|
|
|
|
void veilidInit() {
|
|
|
|
if (kIsWeb) {
|
2024-05-02 14:15:42 -04:00
|
|
|
const platformConfig = VeilidWASMConfig(
|
2022-12-10 12:11:46 -05:00
|
|
|
logging: VeilidWASMConfigLogging(
|
|
|
|
performance: VeilidWASMConfigLoggingPerformance(
|
|
|
|
enabled: true,
|
|
|
|
level: VeilidConfigLogLevel.debug,
|
|
|
|
logsInTimings: true,
|
2024-05-05 09:54:31 -04:00
|
|
|
logsInConsole: true),
|
2022-12-10 12:11:46 -05:00
|
|
|
api: VeilidWASMConfigLoggingApi(
|
|
|
|
enabled: true, level: VeilidConfigLogLevel.info)));
|
2023-05-29 15:24:57 -04:00
|
|
|
Veilid.instance.initializeVeilidCore(platformConfig.toJson());
|
2022-12-10 12:11:46 -05:00
|
|
|
} else {
|
2024-05-02 14:15:42 -04:00
|
|
|
const platformConfig = VeilidFFIConfig(
|
2022-12-10 12:11:46 -05:00
|
|
|
logging: VeilidFFIConfigLogging(
|
|
|
|
terminal: VeilidFFIConfigLoggingTerminal(
|
|
|
|
enabled: false,
|
|
|
|
level: VeilidConfigLogLevel.debug,
|
|
|
|
),
|
|
|
|
otlp: VeilidFFIConfigLoggingOtlp(
|
|
|
|
enabled: false,
|
|
|
|
level: VeilidConfigLogLevel.trace,
|
2024-05-02 14:15:42 -04:00
|
|
|
grpcEndpoint: 'localhost:4317',
|
|
|
|
serviceName: 'VeilidExample'),
|
2022-12-10 12:11:46 -05:00
|
|
|
api: VeilidFFIConfigLoggingApi(
|
2024-07-03 15:03:49 -04:00
|
|
|
enabled: true, level: VeilidConfigLogLevel.info),
|
|
|
|
flame: VeilidFFIConfigLoggingFlame(enabled: false, path: '')));
|
2023-05-29 15:24:57 -04:00
|
|
|
Veilid.instance.initializeVeilidCore(platformConfig.toJson());
|
2022-12-10 12:11:46 -05:00
|
|
|
}
|
|
|
|
}
|