當前位置: 首頁>>代碼示例>>Java>>正文


Java UserBuilder類代碼示例

本文整理匯總了Java中io.sentry.event.UserBuilder的典型用法代碼示例。如果您正苦於以下問題:Java UserBuilder類的具體用法?Java UserBuilder怎麽用?Java UserBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UserBuilder類屬於io.sentry.event包,在下文中一共展示了UserBuilder類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initSentryOnCurrentThread

import io.sentry.event.UserBuilder; //導入依賴的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: getUserBuilder

import io.sentry.event.UserBuilder; //導入依賴的package包/類
@NonNull
private UserBuilder getUserBuilder(ReadableMap user) {
    UserBuilder userBuilder = new UserBuilder();
    if (user.hasKey("email")) {
        userBuilder.setEmail(user.getString("email"));
    }
    if (user.hasKey("userID")) {
        userBuilder.setId(user.getString("userID"));
    } else if (user.hasKey("userId")) {
        userBuilder.setId(user.getString("userId"));
    } else if (user.hasKey("id")) {
        userBuilder.setId(user.getString("id"));
    }
    if (user.hasKey("username")) {
        userBuilder.setUsername(user.getString("username"));
    }
    if (user.hasKey("extra")) {
        userBuilder.setData(((ReadableNativeMap)user.getMap("extra")).toHashMap());
    }
    return userBuilder;
}
 
開發者ID:getsentry,項目名稱:react-native-sentry,代碼行數:22,代碼來源:RNSentryModule.java

示例3: initClient

import io.sentry.event.UserBuilder; //導入依賴的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

示例4: setUser

import io.sentry.event.UserBuilder; //導入依賴的package包/類
@ReactMethod
public void setUser(ReadableMap user) {
    UserBuilder userBuilder = getUserBuilder(user);
    User builtUser = userBuilder.build();
    if (builtUser.getId() != null) {
        Sentry.setUser(builtUser);
    }
}
 
開發者ID:getsentry,項目名稱:react-native-sentry,代碼行數:9,代碼來源:RNSentryModule.java


注:本文中的io.sentry.event.UserBuilder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。