Java Code Examples for com.orhanobut.logger.Logger#init()

The following examples show how to use com.orhanobut.logger.Logger#init() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BasicConfig.java    From BaseUIFrame with MIT License 6 votes vote down vote up
/**
 * 日志打印参数配置
 * @param tag 日志标示,可以为空
 * @param methodCount 显示方法行数,默认为:2
 * @param isHideThreadInfo 是否显示线程信息,默认显示
 * @param adapter 自定义log输出
 * @param isDebug true:打印全部日志,false:不打印日志
 * @return
 */
public BasicConfig initLog(String tag, Integer methodCount,
                           boolean isHideThreadInfo, LogAdapter adapter,
                           boolean isDebug){

    Settings settings = Logger.init(TextUtils.isEmpty(tag) ? LOG_TAG : tag);
    if(null != methodCount){
        settings.methodCount(methodCount);
    }
    if(isHideThreadInfo){
        settings.hideThreadInfo();
    }
    if(null != adapter){
        settings.logAdapter(adapter);
    }
    settings.logLevel(isDebug ? LogLevel.FULL : LogLevel.NONE);
    return this;
}
 
Example 2
Source File: BasicConfig.java    From AndroidBasicProject with MIT License 6 votes vote down vote up
/**
 * 日志打印参数配置
 * @param tag 日志标示,可以为空
 * @param methodCount 显示方法行数,默认为:2
 * @param isHideThreadInfo 是否显示线程信息,默认显示
 * @param adapter 自定义log输出
 * @param isDebug true:打印全部日志,false:不打印日志
 * @return
 */
public BasicConfig initLog(String tag,Integer methodCount,
                           boolean isHideThreadInfo, LogAdapter adapter,
                           boolean isDebug){

    Settings settings = Logger.init(TextUtils.isEmpty(tag) ? LOG_TAG : tag);
    if(null != methodCount){
        settings.methodCount(methodCount);
    }
    if(isHideThreadInfo){
        settings.hideThreadInfo();
    }
    if(null != adapter){
        settings.logAdapter(adapter);
    }
    settings.logLevel(isDebug ? LogLevel.FULL : LogLevel.NONE);
    return this;
}
 
Example 3
Source File: BaseApplication.java    From POCenter with MIT License 5 votes vote down vote up
/**
     * init logger
     */
    private void initLogger() {
        if ((0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)))
            Logger.init(); // for debug, print all log
        else
            Logger.init().logLevel(LogLevel.NONE); // for release, remove all log
//            Logger.init(); // for release, remove all log
    }
 
Example 4
Source File: WriteLogUtil.java    From CoordinatorLayoutExample with Apache License 2.0 5 votes vote down vote up
public static void init(Context context){
    Context applicationContext = context.getApplicationContext();
    if (applicationContext.getExternalCacheDir() != null && isExistSDCard()) {
        cacheDir = applicationContext.getExternalCacheDir().toString();

    }
    else {
        cacheDir = applicationContext.getCacheDir().toString();
    }
    Logger.init(TAG);
    PATH = cacheDir + "/Log";
}
 
Example 5
Source File: ZhihuApplication.java    From RxZhihuPager with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    Logger.init(TAG);
    Stetho.initialize(Stetho.newInitializerBuilder(this)
            .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
            .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
            .build());
    LeakCanary.install(this);
    Fresco.initialize(this);
}
 
Example 6
Source File: JLog.java    From Elephant with Apache License 2.0 5 votes vote down vote up
/**
 * 使用 Logger 工具
 */

public static void logv(String tag, String message) {
    if (DEBUG) {
        Logger.init(tag);
        Logger.v(message);
    }
}
 
Example 7
Source File: JLog.java    From Elephant with Apache License 2.0 5 votes vote down vote up
public static void loge(String tag, String message) {
    if(DEBUG) {
        Logger.init(tag);
        Logger.e(message);

        
    }
}
 
Example 8
Source File: MyDelegate.java    From AndroidModulePattern with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate() {
    Logger.init("pattern");
    //主动添加
    ViewManager.getInstance().addFragment(0, NewsFragment.newInstance());
}
 
Example 9
Source File: DoingDailyMainInit.java    From DoingDaily with Apache License 2.0 4 votes vote down vote up
private void initLog() {
    Logger.init(ConstantValues.DEBUG_TAG);
}
 
Example 10
Source File: AppLog.java    From GithubApp with Apache License 2.0 4 votes vote down vote up
/**
 * initialize the logger.
 */
public static void init() {
    Logger.init(TAG);
}
 
Example 11
Source File: JLog.java    From Elephant with Apache License 2.0 4 votes vote down vote up
public static void logd(String tag, String message) {
    if(DEBUG) {
        Logger.init(tag);
        Logger.d(message);
    }
}
 
Example 12
Source File: JLog.java    From Elephant with Apache License 2.0 4 votes vote down vote up
public static void logi(String tag, String message) {
    if(DEBUG) {
        Logger.init(tag);
        Logger.i(message);
    }
}
 
Example 13
Source File: JLog.java    From Elephant with Apache License 2.0 4 votes vote down vote up
public static void logw(String tag, String message) {
    if(DEBUG) {
        Logger.init(tag);
        Logger.w(message);
    }
}
 
Example 14
Source File: JLog.java    From Elephant with Apache License 2.0 4 votes vote down vote up
public static void loge(String tag, String message, Exception e) {
    if(DEBUG) {
        Logger.init(tag);
        Logger.e(message, e);
    }
}
 
Example 15
Source File: JLog.java    From Elephant with Apache License 2.0 4 votes vote down vote up
public static void logJ(String tag, String message) {
    if (DEBUG) {
        Logger.init(tag);
        Logger.json(message);
    }
}