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


Java Logger.addLogAdapter方法代碼示例

本文整理匯總了Java中com.orhanobut.logger.Logger.addLogAdapter方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.addLogAdapter方法的具體用法?Java Logger.addLogAdapter怎麽用?Java Logger.addLogAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.orhanobut.logger.Logger的用法示例。


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

示例1: onCreate

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    MultiDex.install(this);

    Logger.addLogAdapter(new AndroidLogAdapter() {
        @Override
        public boolean isLoggable(int priority, String tag) {
            return BuildConfig.DEBUG;
        }
    });

    Hawk.init(getBaseContext()).build();

    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
            .setDefaultFontPath("fonts/lato_regular.ttf")
            .setFontAttrId(R.attr.fontPath)
            .build()
    );
}
 
開發者ID:mayuroks,項目名稱:Coin-Tracker,代碼行數:22,代碼來源:BaseApplication.java

示例2: onCreate

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    //初始化Logger
    Logger.addLogAdapter(new AndroidLogAdapter());
    //控製日誌輸出
    LogUtil.LEVEL = LogUtil.VERBOSE;
    context = getApplicationContext();
    //初始化棧視圖功能
    Fragmentation.builder()
            .stackViewMode(Fragmentation.BUBBLE)
            .debug(BuildConfig.DEBUG)
            .handleException(new ExceptionHandler() {
                @Override
                public void onException(Exception e) {
                    //處理異常
                }
            })
            .install();
    //AndroidUtilCode初始化
    Utils.init(this);

}
 
開發者ID:organizationAllink,項目名稱:wzyx-android-user,代碼行數:24,代碼來源:WzyxApplication.java

示例3: onCreate

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false);
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
            .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
            .build();
    Fresco.initialize(this, config);
    SDKInitializer.initialize(this);
    Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75");
    Logger.addLogAdapter(new AndroidLogAdapter(){
        @Override
        public boolean isLoggable(int priority, String tag) {
            return true;// TODO: 2017/6/5
        }
    });
    sInstance = this;
    initUser();
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:20,代碼來源:MyApplication.java

示例4: initBase

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public static void initBase(Application application) {
    instance = application;
    handler = new Handler();
    FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
            .showThreadInfo(false)  // (Optional) Whether to show thread info or not. Default true
            .methodCount(0)         // (Optional) How many method line to show. Default 2
            .methodOffset(7)        // (Optional) Hides internal method calls up to offset. Default 5
            .build();
    Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
}
 
開發者ID:DoomsDayXx,項目名稱:BaseDevelopment,代碼行數:11,代碼來源:Base.java

示例5: init

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public void init(Context context) {
    Cache cache = new Cache(context.getCacheDir(), 10 * 1024 * 1024);
    HttpLoggingInterceptor.Logger logger = new  HttpLoggingInterceptor.Logger() {
        @Override
        public void log(String message) {
            if (message.startsWith("{") || message.startsWith("[")) {
                Logger.json(message);
            } else {
                Log.d("okhttp", "" + message);
            }
        }
    };
    Logger.addLogAdapter(new AndroidLogAdapter());
    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(logger);
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
    okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(new OAuth1SigningInterceptor())
            .addInterceptor(loggingInterceptor)
            .cache(cache)
            .readTimeout(60, TimeUnit.SECONDS)
            .writeTimeout(60, TimeUnit.SECONDS)
            .build();
    Gson gson = new GsonBuilder()
            .setLenient()
            .create();

    retrofit = new Retrofit.Builder()
            .baseUrl(Constants.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .client(okHttpClient)
            .build();
}
 
開發者ID:mingdroid,項目名稱:tumbviewer,代碼行數:33,代碼來源:RestClient.java

示例6: MyLogger

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public MyLogger(@Level int i) {
    LEVEL = i;
    if (LEVEL != NOTHING) {
        Logger.addLogAdapter(new AndroidLogAdapter());
    }
    if (LEVEL == ERROR) {
        Logger.addLogAdapter(new DiskLogAdapter());
    }
}
 
開發者ID:QuincySx,項目名稱:AvenueNet,代碼行數:10,代碼來源:MyLogger.java

示例7: onCreate

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    /**
     * 初始化日誌工具
     */
    Logger.addLogAdapter(new AndroidLogAdapter());
    //TODO 集成:1.4、初始化數據服務SDK、保存設備信息並啟動推送服務
    /**
     * 初始化比目數據SDK
     */
    Bmob.initialize(this, "e9b559bd68461777602a46dead1b581b");
    /**
     * 保存設備信息,用於推送功能
     */
    BmobInstallationManager.getInstance().initialize(new InstallationListener<BmobInstallation>() {
        @Override
        public void done(BmobInstallation bmobInstallation, BmobException e) {
            if (e == null) {
                Logger.i(bmobInstallation.getObjectId() + "-" + bmobInstallation.getInstallationId());
            } else {
                Logger.e(e.getMessage());
            }
        }
    });
    /**
     * 啟動推送服務
     */
    BmobPush.startWork(this);
}
 
開發者ID:chaozhouzhang,項目名稱:bmob-push-demo,代碼行數:31,代碼來源:App.java

示例8: LoggerLog

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public LoggerLog() {
        FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
                .showThreadInfo(true)  // (Optional) Whether to show thread info or not. Default true
                .methodCount(2)         // (Optional) How many method line to show. Default 2
                .methodOffset(2)        // (Optional) Hides internal method calls up to offset. Default 5
//                .logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
//                .tag("My custom tag")   // (Optional) Global tag for every log. Default PRETTY_LOGGER
                .build();
        Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
    }
 
開發者ID:zillachan,項目名稱:AndLog,代碼行數:11,代碼來源:LoggerLog.java

示例9: configure

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
public final void configure() {

        Logger.addLogAdapter(new AndroidLogAdapter());
        LATTE_CONFIGS.put(ConfigKeys.CONFIG_READY, true);
        Utils.init(Bing.getApplicationContext());
    }
 
開發者ID:wang2016215,項目名稱:Bing,代碼行數:7,代碼來源:Configurator.java

示例10: onCreate

import com.orhanobut.logger.Logger; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    Logger.addLogAdapter(new AndroidLogAdapter());
}
 
開發者ID:BittleDragon,項目名稱:MyRepository,代碼行數:6,代碼來源:CustomPBApplication.java


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