CloudSyncConfig class
Configuration for cloud sync of logs to a backend API.
The API key is the primary identifier - the server derives the project
from it, so projectId is optional.
Basic Setup
await VooLogger.initialize(
config: LoggingConfig(
cloudSync: CloudSyncConfig(
enabled: true,
endpoint: 'https://api.yourbackend.com',
apiKey: 'your-api-key',
),
),
);
Configuration Options
- endpoint: Base URL for the logging API
- apiKey: Authentication key for the API (derives project automatically)
- batchSize: Number of logs to batch before sending (default: 50)
- batchInterval: Time interval for automatic batch flush (default: 30s)
- maxRetries: Number of retry attempts on failure (default: 3)
- retryDelay: Delay between retries (default: 1s)
- syncMinimumLevel: Only sync logs at or above this level
Constructors
-
CloudSyncConfig({bool enabled = false, String? endpoint, String? apiKey, String? projectId, int batchSize = 50, Duration batchInterval = const Duration(seconds: 30), int maxRetries = 3, Duration retryDelay = const Duration(seconds: 1), Duration timeout = const Duration(seconds: 10), String? syncMinimumLevel, Map<
String, String> ? headers, bool enableCompression = false, bool prioritizeErrors = true, int maxQueueSize = 1000}) -
const
- CloudSyncConfig.development({required String endpoint, required String apiKey, String? projectId})
-
Creates a development configuration with smaller batches.
factory
- CloudSyncConfig.production({required String endpoint, required String apiKey, String? projectId})
-
Creates a production-ready configuration.
factory
Properties
- apiKey → String?
-
API key for authentication.
final
- batchInterval → Duration
-
Time interval for automatic batch flush.
final
- batchSize → int
-
Number of logs to accumulate before sending a batch.
final
- enableCompression → bool
-
Whether to compress request payloads.
final
- enabled → bool
-
Whether cloud sync is enabled.
final
- endpoint → String?
-
Base URL for the logging API (e.g., 'https://api.devstack.io').
final
- hashCode → int
-
The hash code for this object.
no setteroverride
-
headers
→ Map<
String, String> ? -
Custom headers to include in requests.
final
- isValid → bool
-
Validates that the configuration is complete for syncing.
no setter
- logEndpoint → String?
-
Returns the full endpoint URL for log ingestion.
Uses standardized telemetry endpoint format.
Note: endpoint should already include /api if needed (e.g., 'http://localhost:5001/api')
no setter
- maxQueueSize → int
-
Maximum number of logs to queue locally before dropping old ones.
final
- maxRetries → int
-
Maximum number of retry attempts on failure.
final
- prioritizeErrors → bool
-
Whether to sync immediately for error/fatal logs.
final
- projectId → String?
-
Project ID (optional, for local reference only).
final
- retryDelay → Duration
-
Delay between retry attempts.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- syncMinimumLevel → String?
-
Only sync logs at or above this level (null = sync all).
final
- timeout → Duration
-
HTTP timeout for requests.
final
Methods
-
copyWith(
{bool? enabled, String? endpoint, String? apiKey, String? projectId, int? batchSize, Duration? batchInterval, int? maxRetries, Duration? retryDelay, Duration? timeout, String? syncMinimumLevel, Map< String, String> ? headers, bool? enableCompression, bool? prioritizeErrors, int? maxQueueSize}) → CloudSyncConfig -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override