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


Java DefaultLogger类代码示例

本文整理汇总了Java中com.mpush.util.DefaultLogger的典型用法代码示例。如果您正苦于以下问题:Java DefaultLogger类的具体用法?Java DefaultLogger怎么用?Java DefaultLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultLogger类属于com.mpush.util包,在下文中一共展示了DefaultLogger类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClientConfig

import com.mpush.util.DefaultLogger; //导入依赖的package包/类
@Nullable
private ClientConfig getClientConfig() {
    if (clientConfig == null) {
        String clientVersion = sp.getString(SP_KEY_CV, null);
        String deviceId = sp.getString(SP_KEY_DI, null);
        String publicKey = sp.getString(SP_KEY_PK, null);
        String allocServer = sp.getString(SP_KEY_AS, null);
        boolean logEnabled = sp.getBoolean(SP_KEY_LG, false);
        clientConfig = ClientConfig.build()
                .setPublicKey(publicKey)
                .setAllotServer(allocServer)
                .setDeviceId(deviceId)
                .setOsName(Constants.DEF_OS_NAME)
                .setOsVersion(Build.VERSION.RELEASE)
                .setClientVersion(clientVersion)
                .setLogger(new MPushLog())
                .setLogEnabled(logEnabled);
    }
    if (clientConfig.getClientVersion() == null
            || clientConfig.getPublicKey() == null
            || clientConfig.getAllotServer() == null) {
        return null;
    }

    if (clientConfig.getSessionStorageDir() == null) {
        clientConfig.setSessionStorage(new SPSessionStorage(sp));
    }

    if (clientConfig.getOsVersion() == null) {
        clientConfig.setOsVersion(Build.VERSION.RELEASE);
    }

    if (clientConfig.getUserId() == null) {
        clientConfig.setUserId(sp.getString(SP_KEY_AT, null));
    }

    if (clientConfig.getTags() == null) {
        clientConfig.setTags(sp.getString(SP_KEY_TG, null));
    }

    if (clientConfig.getLogger() instanceof DefaultLogger) {
        clientConfig.setLogger(new MPushLog());
    }
    return clientConfig;
}
 
开发者ID:stulip,项目名称:react-native-mpush,代码行数:46,代码来源:MPush.java

示例2: main

import com.mpush.util.DefaultLogger; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    int count = 1;
    String serverHost = "127.0.0.1";
    int sleep = 1000;

    if (args != null && args.length > 0) {
        count = Integer.parseInt(args[0]);
        if (args.length > 1) {
            serverHost = args[1];
        }
        if (args.length > 2) {
            sleep = Integer.parseInt(args[1]);
        }
    }

    ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
    ClientListener listener = new L(scheduledExecutor);
    Client client = null;
    String cacheDir = MPushClientTest.class.getResource("/").getFile();
    for (int i = 0; i < count; i++) {
        client = ClientConfig
                .build()
                .setPublicKey(publicKey)
                .setAllotServer(allocServer)
                .setServerHost(serverHost)
                .setServerPort(3000)
                .setDeviceId("deviceId-test" + i)
                .setOsName("android")
                .setOsVersion("6.0")
                .setClientVersion("2.0")
                .setUserId("user-" + i)
                .setTags("tag-" + i)
                .setSessionStorageDir(cacheDir + i)
                .setLogger(new DefaultLogger())
                .setLogEnabled(true)
                .setEnableHttpProxy(true)
                .setClientListener(listener)
                .create();
        client.start();
        Thread.sleep(sleep);
    }
}
 
开发者ID:mpusher,项目名称:mpush-client-java,代码行数:43,代码来源:MPushClientTest.java


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