Skip to content

Instantly share code, notes, and snippets.

View PanosJee's full-sized avatar

Panos Papadopoulos PanosJee

View GitHub Profile
@PanosJee
PanosJee / gist:3551914
Created August 31, 2012 12:03
Adding metadata to Bugsense Android handled crash reports
HashMap<String, String> map = new HashMap<String, String>();
map.put("level", "second level");
map.put("difficulty", "impossibruuu");
BugSenseHandler.sendExceptionMap(map, ex);
@PanosJee
PanosJee / gist:3552211
Created August 31, 2012 12:34
BugSense2 Android setup
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BugSenseHandler.initAndStartSession(Context, APIKEY);
setContentView(R.layout.main);
//rest of your code here
}
@PanosJee
PanosJee / App.xaml.cs
Created October 30, 2012 15:04
Initialize Bugsense
public App()
{
// Standard XAML initialization
InitializeComponent();
// Phone-specific initialization
InitializePhoneApplication();
// Language display initialization
InitializeLanguage();
@PanosJee
PanosJee / gist:3980775
Created October 30, 2012 15:07
Add extra data & leave breadcrumb
// Adding custom extra to be sent with the crash
BugSenseHandler.AddToExtraData("xtra1key", "xtra1val");
BugSenseHandler.AddToExtraData("xtra2key", "xtra2val");
// Leave a breadcrump
BugSenseHandler.LeaveBreadcrumb("Fetch friends");
// Check is a task if task is faulted and log task exception if it failed
Task t = new Task(() =>
{
int x = 5;
int y = 0;
int z = x / y;
});
t.Start();
@PanosJee
PanosJee / gist:3980821
Created October 30, 2012 15:12
Logged Exceptions for WP8/W8
// Without extra data
try
{
throw new Exception("error");
}
catch (Exception exc)
{
BugSenseHandler.Instance.LogException(exc);
}
@PanosJee
PanosJee / gist:4135881
Created November 23, 2012 14:33
BugSense JS init
<script src="http://www.bugsense.com/static/js/global/bugsense.js" type='text/javascript'></script>
<script type="text/javascript">
var bugsense = new Bugsense( { apiKey: 'YOUR_API_KEY' } );
</script>
@PanosJee
PanosJee / gist:4135906
Created November 23, 2012 14:41
Handled JS exception
try {
rotateScreen();
} catch ( error ) {
bugsense.notify( error, { rotation: 'not supported' } )
};
@PanosJee
PanosJee / gist:4135955
Created November 23, 2012 14:46
Bugsense.js breadcrumbs & metadata
// add metadata
bugsense.addExtraData( 'user_level', 'paid' );
bugsense.addExtraData( 'account', 'CEO' );
// Clear all metadata
bugsense.clearExtraData();
// leave breadcrumb
bugsense.leaveBreadcrumb( 'Fetch Friendlist' );
@PanosJee
PanosJee / default.js
Created November 27, 2012 15:46
WinJS bugsense initialization
// Create the app
var app = WinJS.Application;
// Initialize bugsense
var bugsense = new Bugsense( {
apiKey: 'YOUR_API_KEY',
context: app
} );
// If you want to display a popup (against MS guidelines) add the message option