Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
Sync Data

Establecer el nivel de registro del cliente - Swift SDK

You can set or change your app's log level to develop or debug your application. You might want to change the log level to log different amounts of data depending on the app's environment.

Changed in version 10.39.0:: Deprecated in favor of Realm Logger

Advertencia

This page shows how to set a Sync client log level in Realm Swift SDK versions 10.38.3 and earlier. Realm Swift SDK v10.39.0 supersedes this logging implementation with a Realm logger you can set and configure. For information on how to set a Realm logger in a later version, refer to Logging - Swift SDK.

Puede configurar el nivel de registro del cliente de sincronización del dispositivo en el Instancia deRLMSyncManager en su RLMApp.

// Access your app
RLMApp *app = [RLMApp appWithId:YOUR_APP_ID];
// Access the sync manager for the app
RLMSyncManager *syncManager = [app syncManager];
// Set the logger to provide debug logs
syncManager.logLevel = RLMSyncLogLevelDebug;

Puede configurar el nivel de registro del cliente de sincronización del dispositivo en la instancia de SyncManager en su aplicación.

// This code example shows how to set the log level
// in Realm Swift 10.38.3 and lower. For 10.39.0 and higher,
// use the `Logger` API.
// Access your app
let app = App(id: YOUR_APP_SERVICES_APP_ID)
// Access the sync manager for the app
let syncManager = app.syncManager
// Set the logger to provide debug logs
syncManager.logLevel = .debug

Tip

Tip

Para diagnosticar y solucionar errores mientras desarrolla su aplicación, configure el nivel de registro en debug o trace. Para implementaciones de producción, reduzca el nivel de registro para mejorar el rendimiento.

You can pipe Device Sync logs to a custom logger by setting the logger property on the SyncManager. You must set this property before you open any synced realms.

Si no especificas esta propiedad, el SDK Realm Swift envía las cadenas de registro al Apple System Logger.

let app = App(id: YOUR_APP_SERVICES_APP_ID)
// Access the sync manager for the app
let syncManager = app.syncManager
// Set the logger to provide debug logs
syncManager.logLevel = .all
syncManager.logger = { logLevel, message in
AnalyticsProvider.shared.logEvent("\(logLevel) : \(message)", category: "Engineering debugging")
}

Volver

Manage Sync Sessions

En esta página