当前位置: 首页>>代码示例>>Java>>正文


Java Sentry.init方法代码示例

本文整理汇总了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);
			}
		});

	}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:17,代码来源:TransportPipes.java

示例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]");
}
 
开发者ID:imcj,项目名称:QQQAndroid,代码行数:19,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Frederikam,项目名称:Lavalink,代码行数:23,代码来源:Launcher.java

示例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);
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:28,代码来源:Entrance.java

示例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();
    }));
}
 
开发者ID:k0kubun,项目名称:gitstar-ranking,代码行数:19,代码来源:Main.java

示例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);
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:15,代码来源:Entrance.java

示例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");
	}
}
 
开发者ID:lucapompei,项目名称:WebTemplate,代码行数:16,代码来源:SentryConfig.java

示例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);
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:19,代码来源:TkApp.java

示例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);
}
 
开发者ID:yegor256,项目名称:jare,代码行数:18,代码来源:Entrance.java

示例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
    );
}
 
开发者ID:yegor256,项目名称:wring,代码行数:11,代码来源:Routine.java

示例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();
    }
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:32,代码来源:WebAPI.java

示例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;
}
 
开发者ID:bootique,项目名称:bootique-logback,代码行数:8,代码来源:LogbackSentryModule.java

示例13: IStacktraceHandler

import io.sentry.Sentry; //导入方法依赖的package包/类
public IStacktraceHandler(LegendaryBot bot, String sentryKey) {
    this.bot = bot;
    client = Sentry.init(sentryKey);
}
 
开发者ID:greatman,项目名称:legendarybot,代码行数:5,代码来源:IStacktraceHandler.java


注:本文中的io.sentry.Sentry.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。