本文整理汇总了Java中io.sentry.Sentry.init方法的典型用法代码示例。如果您正苦于以下问题:Java Sentry.init方法的具体用法?Java Sentry.init怎么用?Java Sentry.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.sentry.Sentry
的用法示例。
在下文中一共展示了Sentry.init方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSentryOnCurrentThread
import io.sentry.Sentry; //导入方法依赖的package包/类
public static void initSentryOnCurrentThread() {
Sentry.init("https://2eb0fc30f86a4871a85755ecdde11679:[email protected]/252970");
Sentry.getContext().setUser(new UserBuilder().setUsername("RoboTricker").build());
Sentry.getContext().addTag("thread", Thread.currentThread().getName());
Sentry.getContext().addTag("version", TransportPipes.instance.getDescription().getVersion());
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
Sentry.capture(e);
}
});
}
示例2: onCreate
import io.sentry.Sentry; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context ctx = this.getApplicationContext();
// Use the Sentry DSN (client key) from the Project Settings page on Sentry
Config.initialize(getApplicationContext());
Config config = Config.shared();
String sentryDsn = config.sentry();
Sentry.init(sentryDsn, new AndroidSentryClientFactory(ctx));
Intent intent = new Intent(this, IncomingService.class);
startService(intent);
Log.i(getClass().getName(), "Activity created]");
}
示例3: initSentry
import io.sentry.Sentry; //导入方法依赖的package包/类
private void initSentry() {
String sentryDsn = config.getSentryDsn();
if (sentryDsn == null || sentryDsn.isEmpty()) {
turnOffSentry();
return;
}
SentryClient sentryClient = Sentry.init(sentryDsn);
// set the git commit hash this was build on as the release
Properties gitProps = new Properties();
try {
gitProps.load(Launcher.class.getClassLoader().getResourceAsStream("git.properties"));
} catch (NullPointerException | IOException e) {
log.error("Failed to load git repo information", e);
}
String commitHash = gitProps.getProperty("git.commit.id.full");
if (commitHash == null || commitHash.isEmpty()) {
return;
}
sentryClient.setRelease(commitHash);
}
示例4: main
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Main entry point.
* @param args Arguments
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
Sentry.init(Manifests.read("ThreeCopies-SentryDsn"));
final Base base = new DyBase(new Dynamo());
new Routine(
base,
new Shell.Safe(
new Ssh(
"d1.threecopies.com",
Ssh.PORT,
"threecopies",
new TextOf(
new ResourceOf("com/threecopies/routine/ssh.key")
).asString()
)
),
new Region.Simple(
Manifests.read("ThreeCopies-S3Key"),
Manifests.read("ThreeCopies-S3Secret")
).bucket("logs.threecopies.com")
).start();
new FtCli(new TkApp(base), args).start(Exit.NEVER);
}
示例5: main
import io.sentry.Sentry; //导入方法依赖的package包/类
public static void main(String[] args)
{
Sentry.init(System.getenv().get("SENTRY_DSN"));
ScheduledExecutorService scheduler = buildAndRunScheduler();
WorkerManager workers = buildWorkers(config);
workers.start();
ApiServer server = new ApiServer(ApiApplication.class, config);
server.start();
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
shutdownAndAwaitTermination(scheduler);
server.stop();
workers.stop();
}));
}
示例6: main
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Main entry point.
* @param args Arguments
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
Sentry.init(Manifests.read("Rehttp-SentryDsn"));
final Base base = new DyBase(new Dynamo());
Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(
new RunnableOf<>(new VerboseCallable<Void>(new Retry(base), true)),
1L, 1L, TimeUnit.MINUTES
);
new FtCli(new TkApp(base), args).start(Exit.NEVER);
}
示例7: initClient
import io.sentry.Sentry; //导入方法依赖的package包/类
@PostConstruct
private void initClient() {
if (isSentryEnabled) {
LOGGER.info("Enabling Sentry for errors/crashes reporting");
// initialize sentry
Sentry.init();
// configure user for sentry
User sentryUser = new UserBuilder().setUsername(appName).build();
Sentry.getContext().setUser(sentryUser);
// add additional information to sentry
Sentry.getContext().addTag("tagName", appVersion);
} else {
LOGGER.info("Sentry is not enabled by properties, so crashes/errors are not reporting on it");
}
}
示例8: main
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Main Java entry point.
* @param args Command line args
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
Sentry.init(
new PropertiesOf(
new ResourceOf(
"org/jpeek/jpeek.properties"
)
).value().getProperty("org.jpeek.sentry")
);
new FtCli(
new TkApp(Files.createTempDirectory("jpeek")),
args
).start(Exit.NEVER);
}
示例9: main
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Main entry point.
* @param args Arguments
* @throws IOException If fails
*/
public static void main(final String... args) throws IOException {
Sentry.init(Manifests.read("Jare-SentryDsn"));
final Base base = new CdBase(new DyBase());
new Logs(
base,
new Region.Simple(
Manifests.read("Jare-S3Key"),
Manifests.read("Jare-S3Secret")
).bucket("logs.jare.io")
);
new FtCli(new TkApp(base), args).start(Exit.NEVER);
}
示例10: start
import io.sentry.Sentry; //导入方法依赖的package包/类
/**
* Start it.
*/
public void start() {
Sentry.init(Manifests.read("Wring-SentryDsn"));
this.executor.scheduleWithFixedDelay(
new VerboseRunnable(this, true, true),
1L, 1L, TimeUnit.MINUTES
);
}
示例11: WebAPI
import io.sentry.Sentry; //导入方法依赖的package包/类
public WebAPI() {
System.setProperty("sentry.dsn", "https://fb64795d2a5c4ff18f3c3e4117d7c245:[email protected]/203545");
System.setProperty("sentry.release", Constants.VERSION.split("-")[0]);
System.setProperty("sentry.maxmessagelength", "2000");
System.setProperty("sentry.stacktrace.app.packages", WebAPI.class.getPackage().getName());
Sentry.init();
// Add our own jar to the system classloader classpath,
// because some external libraries don't work otherwise.
try {
CodeSource src = WebAPI.class.getProtectionDomain().getCodeSource();
if (src == null) {
throw new IOException("Could not get code source!");
}
URL jar = src.getLocation();
String str = jar.toString();
if (str.indexOf("!") > 0) {
jar = new URL(jar.toString().substring(0, str.indexOf("!") + 2));
}
URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class sysclass = URLClassLoader.class;
Method method = sysclass.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
method.invoke(sysloader, jar);
} catch (IOException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
}
示例12: bootiqueSentryClientFactory
import io.sentry.Sentry; //导入方法依赖的package包/类
@Singleton
@Provides
public SentryClientFactory bootiqueSentryClientFactory(LogbackSentryFactory logbackSentryFactory) {
final BootiqueSentryClientFactory sentryClientFactory = new BootiqueSentryClientFactory(logbackSentryFactory);
Sentry.init(logbackSentryFactory.getDsn(), sentryClientFactory);
return sentryClientFactory;
}
示例13: IStacktraceHandler
import io.sentry.Sentry; //导入方法依赖的package包/类
public IStacktraceHandler(LegendaryBot bot, String sentryKey) {
this.bot = bot;
client = Sentry.init(sentryKey);
}