2022-12-10 17:11:46 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:veilid/veilid.dart';
|
|
|
|
|
|
|
|
// Initialize Veilid
|
|
|
|
// Call only once.
|
|
|
|
void veilidInit() {
|
|
|
|
if (kIsWeb) {
|
|
|
|
var platformConfig = VeilidWASMConfig(
|
|
|
|
logging: VeilidWASMConfigLogging(
|
|
|
|
performance: VeilidWASMConfigLoggingPerformance(
|
|
|
|
enabled: true,
|
|
|
|
level: VeilidConfigLogLevel.debug,
|
|
|
|
logsInTimings: true,
|
2022-12-11 00:11:58 +00:00
|
|
|
logsInConsole: false),
|
2022-12-10 17:11:46 +00:00
|
|
|
api: VeilidWASMConfigLoggingApi(
|
|
|
|
enabled: true, level: VeilidConfigLogLevel.info)));
|
2023-05-15 15:33:32 +00:00
|
|
|
Veilid.instance.initializeVeilidCore(platformConfig.toJson());
|
2022-12-10 17:11:46 +00:00
|
|
|
} else {
|
|
|
|
var platformConfig = VeilidFFIConfig(
|
|
|
|
logging: VeilidFFIConfigLogging(
|
|
|
|
terminal: VeilidFFIConfigLoggingTerminal(
|
|
|
|
enabled: false,
|
|
|
|
level: VeilidConfigLogLevel.debug,
|
|
|
|
),
|
|
|
|
otlp: VeilidFFIConfigLoggingOtlp(
|
|
|
|
enabled: false,
|
|
|
|
level: VeilidConfigLogLevel.trace,
|
|
|
|
grpcEndpoint: "localhost:4317",
|
|
|
|
serviceName: "VeilidExample"),
|
|
|
|
api: VeilidFFIConfigLoggingApi(
|
|
|
|
enabled: true, level: VeilidConfigLogLevel.info)));
|
2023-05-15 15:33:32 +00:00
|
|
|
Veilid.instance.initializeVeilidCore(platformConfig.toJson());
|
2022-12-10 17:11:46 +00:00
|
|
|
}
|
|
|
|
}
|