private void send(final LogRecord record) { final MetaData data = new MetaData(); if (plugin.getServerInformation() != null) { data.put("account_id", plugin.getServerInformation().getAccount().getId()); data.put("server_id", plugin.getServerInformation().getServer().getId()); data.put("platform", "bukkit"); } if (record.getLevel() == Level.SEVERE) { client.notify(record.getThrown(), "error", data); } else if (record.getLevel() == Level.WARNING) { client.notify(record.getThrown(), "warning", data); } }
/** * Create a BugSnag Client, we rely on the configuration URL to create this object * * @return BugSnag Client */ @Bean @Scope(value = "singleton") public Client getBugSnagClient() { if (configuration.getApp().getMode().equals(MovieTimeConfig.RunModeEnum.TEST)) return null; Client bugSnag = new Client(configuration.getApp().getBugSnag()); // set the current version bugSnag.setAppVersion(configuration.getApp().getVersion()); // set the current release stage bugSnag.setReleaseStage(configuration.getApp().getMode().toString()); // notify about exception only in production mode; bugSnag.setNotifyReleaseStages(MovieTimeConfig.RunModeEnum.PROD.toString()); log.info( "BugSnag bootstrapped with application version {}", configuration.getApp().getVersion()); return bugSnag; }