-
Notifications
You must be signed in to change notification settings - Fork 21
How to enable SDK logging for troubleshooting purposes
If you are using Cocoapods, by adding pod 'MobileMessaging'
in your Podfile, CocoaLumberjack logging will be enabled automatically,
for debug builds it prints logs for the level >= .Info
to the console,
for release builds it saves logs for the level >= .Warning
to the file.
If you don't want to use CocoaLumberjack logging, you can install a Core version of MobileMessaging SDK. In your Podfile
use the following code:
pod 'MobileMessaging/Core'
Put this line before starting Mobile Messaging SDK:
MobileMessaging.logger = MMDefaultLogger()
If you are using Carthage, put this line before starting Mobile Messaging SDK, to enable default logger
MobileMessaging.logger = MMDefaultLogger()
or this, if you want to enable CocoaLumberjack logger:
MobileMessaging.logger = MMLumberjackLogger(logOutput: .Console, logLevel: .Debug)
If you are using Swift Package Manager to enable CocoaLumberjack logging add MobileMessagingLumberjack
module.
Then, put this line before starting the Mobile Messaging SDK, specify logOutput
and logLevel
options:
MobileMessaging.logger = MMLumberjackLogger(logOutput: .Console, logLevel: .Debug)
To enable default logging add MobileMessaging
module, put this line before starting Mobile Messaging SDK:
MobileMessaging.logger = MMDefaultLogger()
If you'd like to change logger options use MMLogging API
MobileMessaging.logger?.logLevel = .Warning
MobileMessaging.logger?.logOutput = .File
Also, you can use your own logging tool by implementing the MMLogging
protocol and setting your logger as a MobileMessaging default logger:
class CustomMagicLogger: MMLogging {
var logOutput: MMLogOutput { ... }
var logLevel: MMLogLevel { ... }
var logFilePath: String? { ... }
func sendLogs(fromViewController vc: UIViewController) { ... }
func logDebug(message: String) { ... }
func logInfo(message: String) { ... }
func logError(message: String) { ... }
func logWarn(message: String) { ... }
func logVerbose(message: String) { ... }
}
...
MobileMessaging.logger = CustomMagicLogger()
If you have any questions or suggestions, feel free to send an email to support@infobip.com or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
- Geofencing service
- Privacy settings
- In-app chat
- WebRTC Calls and UI