Skip to main content
All CollectionsGetting started
How do I specify the logs I want to send with Bugfender SDK?
How do I specify the logs I want to send with Bugfender SDK?
Jordi Giménez avatar
Written by Jordi Giménez
Updated over 2 years ago

Bugfender is a remote logger: that means you can send logs to it and it will store them.

On iOS (Swift)

You initialize Bugfender this way:

Bugfender.activateLogger("1Q37ELhyVrEQGkuM0jUoTNXiXFkn66g0")
Bugfender.enableUIEventLogging()  // optional, log user interactions automatically

Then, log using BFLog the same way you would use NSLog:

BFLog("Hello world, current time is \(Date())!") // use BFLog as you would use NSLog

You can also specify a level when logging: 

Bugfender.print("info level")
Bugfender.warning("warning level")
Bugfender.error("error level")

If you have a logging framework in your application, such as CocoaLumberjack, you can plug it to Bugfender. See our List of supported frameworks.

Automatic UI logs

The automated UI Event logger detects user interaction with the application, such as touches on buttons and gestures, and logs them. Also detects changes in screen (for example UIViewControllers in a UINavigationController) and logs them. In order to use it, call enableUIEventLogging when initializing Bugfender.

On iOS (Objective-C)

You initialize Bugfender this way:

[Bugfender activateLogger:@"your app key"];
[Bugfender enableUIEventLogging]; // optional, log user interactions automatically

Then, log using BFLog the same way you would use NSLog:

BFLog(@"Hello world, current time is: %@", [[NSDate date] description]);

You can also specify a level when logging: 

BFLog(@"Info level");
BFLogWarn(@"Warning level");
BFLogErr(@"Error level");

You can also specify a log level and tags:

BFLog2(BFLogLevelWarning,
       @"networking error",
       @"This is a warning with some tags. Error code: %ld", (long)23);

If you have a logging framework in your application, such as CocoaLumberjack, you can plug it to Bugfender. See our List of supported frameworks.

Automatic UI logs

The automated UI Event logger detects user interaction with the application, such as touches on buttons and gestures, and logs them. Also detects changes in screen (for example UIViewControllers in a UINavigationController) and logs them. In order to use it, call enableUIEventLogging when initializing Bugfender.

On Android

You initialize Bugfender this way:

Bugfender.init(this, "your app key", BuildConfig.DEBUG);
Bugfender.enableUIEventLogging(this); // optional, log user interactions automatically
Bugfender.enableLogcatLogging(); // optional, fetch logcat automatically

Automatic logcat logs

Bugfender can take logs from logcat. These logs are generated both by the system and by using the standard Android logger in your code, such as Log.d(). In order to use it, call Bugfender.enableLogcatLogging() when initializing Bugfender.

If you prefer not to use this option, you can log directly to Bugfender the same way you would use android.util.Log:

Bugfender.d("networking", "this is a debug message");
Bugfender.w("networking", "this is a warning message");
Bugfender.e("networking", "this is an error message");

If you have a logging library in your application, such as SLF4J, you can plug it to Bugfender. See our List of supported libraries.

Automatic UI logs 

The automated UI Event logger detects user interaction with the application, such as touches on buttons and gestures, and logs them. Also detects changes in screen (for example UIViewControllers in a UINavigationController) and logs them. In order to use it, call Bugfender.enableUIEventLogging() when initializing Bugfender.

Did this answer your question?