com.socks.jiandan.utils.logger.Logger Java Examples
The following examples show how to use
com.socks.jiandan.utils.logger.Logger.
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: RequestManager.java From JianDan_OkHttp with Apache License 2.0 | 6 votes |
public static void addRequest(Request<?> request, Object tag) { if (tag != null) { request.setTag(tag); } //给每个请求重设超时、重试次数 request.setRetryPolicy(new DefaultRetryPolicy( OUT_TIME, TIMES_OF_RETRY, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); mRequestQueue.add(request); if (BuildConfig.DEBUG) { Logger.d(request.getUrl()); } }
Example #2
Source File: RequestManager.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 6 votes |
public static void addRequest(Request<?> request, Object tag) { if (tag != null) { request.setTag(tag); } //给每个请求重设超时、重试次数 request.setRetryPolicy(new DefaultRetryPolicy( OUT_TIME, TIMES_OF_RETRY, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); mRequestQueue.add(request); if (BuildConfig.DEBUG) { Logger.d(request.getUrl()); } }
Example #3
Source File: JDApplication.java From JianDan with Apache License 2.0 | 6 votes |
@Override public void onCreate() { StrictModeUtil.init(); super.onCreate(); refWatcher = LeakCanary.install(this); mContext = this; ImageLoadProxy.initImageLoader(this); if (BuildConfig.DEBUG) { Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL); } Stetho.initialize( Stetho.newInitializerBuilder(this) .enableDumpapp(Stetho.defaultDumperPluginsProvider(this)) .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this)) .build()); }
Example #4
Source File: RequestManager.java From JianDan with Apache License 2.0 | 6 votes |
public static void addRequest(Request<?> request, Object tag) { if (tag != null) { request.setTag(tag); } //给每个请求重设超时、重试次数 request.setRetryPolicy(new DefaultRetryPolicy( OUT_TIME, TIMES_OF_RETRY, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); mRequestQueue.add(request); if (BuildConfig.DEBUG) { Logger.d(request.getUrl()); } }
Example #5
Source File: JDApplication.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override public void onCreate() { StrictModeUtil.init(); super.onCreate(); refWatcher = LeakCanary.install(this); mContext = this; ImageLoadProxy.initImageLoader(this); if (BuildConfig.DEBUG) { Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL); } }
Example #6
Source File: Request4PushFreshComment.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
/** * 包装无父评论的请求参数 * * @return */ public static String getRequestURLNoParent(String post_id, String name, String email, String content) { //方法1 转义 //content= MessageFormat.format("%40%3Ca+href%3D%27%23comment-{0}%27%3E{1}%3C%2Fa%3E%3A+{2}",parent_id,parent_name, content); //方法2 URLEncoder(更优) try { name = URLEncoder.encode(name, "utf-8"); content = URLEncoder.encode(content, "utf-8"); } catch (Exception ex) { Logger.d("URLEncoder error"); } return MessageFormat.format("{0}&post_id={1}&content={2}&email={3}&name={4}", Comment4FreshNews.URL_PUSH_COMMENT, post_id, content, email, name); }
Example #7
Source File: Push4FreshCommentParser.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
/** * 包装无父评论的请求参数 * * @return */ public static String getRequestURLNoParent(String post_id, String name, String email, String content) { //方法1 转义 //content= MessageFormat.format("%40%3Ca+href%3D%27%23comment-{0}%27%3E{1}%3C%2Fa%3E%3A+{2}",parent_id,parent_name, content); //方法2 URLEncoder(更优) try { name = URLEncoder.encode(name, "utf-8"); content = URLEncoder.encode(content, "utf-8"); } catch (Exception ex) { Logger.d("URLEncoder error"); } return MessageFormat.format("{0}&post_id={1}&content={2}&email={3}&name={4}", Comment4FreshNews.URL_PUSH_COMMENT, post_id, content, email, name); }
Example #8
Source File: BaseFragment.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (BuildConfig.DEBUG) { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.FULL).hideThreadInfo(); } else { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.NONE).hideThreadInfo(); } }
Example #9
Source File: JDApplication.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public void onCreate() { StrictModeUtil.init(); super.onCreate(); refWatcher = LeakCanary.install(this); mContext = this; ImageLoadProxy.initImageLoader(this); if (BuildConfig.DEBUG) { Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL); } }
Example #10
Source File: BaseActivity.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; if (BuildConfig.DEBUG) { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.FULL).hideThreadInfo(); } else { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.NONE).hideThreadInfo(); } }
Example #11
Source File: Request4PushFreshComment.java From JianDan with Apache License 2.0 | 5 votes |
/** * 包装无父评论的请求参数 * * @return */ public static String getRequestURLNoParent(String post_id,String name, String email,String content) { //方法1 转义 //content= MessageFormat.format("%40%3Ca+href%3D%27%23comment-{0}%27%3E{1}%3C%2Fa%3E%3A+{2}",parent_id,parent_name, content); //方法2 URLEncoder(更优) try { name = URLEncoder.encode(name, "utf-8"); content=URLEncoder.encode(content, "utf-8"); }catch (Exception ex){ Logger.d("URLEncoder error"); } return MessageFormat.format("{0}&post_id={1}&content={2}&email={3}&name={4}", Comment4FreshNews.URL_PUSH_COMMENT, post_id, content, email, name); }
Example #12
Source File: BaseFragment.java From JianDan with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (BuildConfig.DEBUG) { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.FULL).hideThreadInfo(); } else { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.NONE).hideThreadInfo(); } }
Example #13
Source File: BaseActivity.java From JianDan with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; if (BuildConfig.DEBUG) { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.FULL).hideThreadInfo(); } else { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.NONE).hideThreadInfo(); } }
Example #14
Source File: Request4PushFreshComment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
/** * 包装无父评论的请求参数 * * @return */ public static String getRequestURLNoParent(String post_id,String name, String email,String content) { //方法1 转义 //content= MessageFormat.format("%40%3Ca+href%3D%27%23comment-{0}%27%3E{1}%3C%2Fa%3E%3A+{2}",parent_id,parent_name, content); //方法2 URLEncoder(更优) try { name = URLEncoder.encode(name, "utf-8"); content=URLEncoder.encode(content, "utf-8"); }catch (Exception ex){ Logger.d("URLEncoder error"); } return MessageFormat.format("{0}&post_id={1}&content={2}&email={3}&name={4}", Comment4FreshNews.URL_PUSH_COMMENT, post_id, content, email, name); }
Example #15
Source File: BaseFragment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (BuildConfig.DEBUG) { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.FULL).hideThreadInfo(); } else { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.NONE).hideThreadInfo(); } }
Example #16
Source File: BaseActivity.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; if (BuildConfig.DEBUG) { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.FULL).hideThreadInfo(); } else { Logger.init(getClass().getSimpleName()).setLogLevel(LogLevel.NONE).hideThreadInfo(); } }
Example #17
Source File: Request4PushFreshComment.java From JianDan with Apache License 2.0 | 4 votes |
public Request4PushFreshComment(String url, Response .Listener<Boolean> listener, Response.ErrorListener errorListener) { super(Method.GET, url, errorListener); Logger.d(url); this.listener = listener; }
Example #18
Source File: Request4FreshNewsCommentList.java From JianDan with Apache License 2.0 | 4 votes |
@Override protected Response<ArrayList<Comment4FreshNews>> parseNetworkResponse(NetworkResponse response) { try { String resultStr = new String(response.data, HttpHeaderParser.parseCharset(response.headers)); JSONObject resultObj = new JSONObject(resultStr); String status = resultObj.optString("status"); if (status.equals("ok")) { String commentsStr = resultObj.optJSONObject("post").optJSONArray("comments") .toString(); int id = resultObj.optJSONObject("post").optInt("id"); mCallBack.loadFinish(Integer.toString(id)); ArrayList<Comment4FreshNews> comment4FreshNewses = (ArrayList<Comment4FreshNews>) JSONParser.toObject(commentsStr, new TypeToken<ArrayList<Comment4FreshNews>>() { }.getType()); Pattern pattern = Pattern.compile("\\d{7}"); for (Comment4FreshNews comment4FreshNews : comment4FreshNewses) { Matcher matcher = pattern.matcher(comment4FreshNews.getContent()); boolean isHas7Num = matcher.find(); boolean isHasCommentStr = comment4FreshNews.getContent().contains("#comment-"); //有回复 if (isHas7Num && isHasCommentStr || comment4FreshNews.getParentId() != 0) { ArrayList<Comment4FreshNews> tempComments = new ArrayList<>(); int parentId = getParentId(comment4FreshNews.getContent()); comment4FreshNews.setParentId(parentId); getParenFreshNews(tempComments, comment4FreshNewses, parentId); Collections.reverse(tempComments); comment4FreshNews.setParentComments(tempComments); comment4FreshNews.setFloorNum(tempComments.size() + 1); comment4FreshNews.setContent(getContentWithParent(comment4FreshNews.getContent())); } else { comment4FreshNews.setContent(getContentOnlySelf(comment4FreshNews.getContent())); } } Logger.d("" + comment4FreshNewses); return Response.success(comment4FreshNewses, HttpHeaderParser .parseCacheHeaders(response)); } else { return Response.error(new ParseError(new Exception("request failed"))); } } catch (Exception e) { e.printStackTrace(); return Response.error(new ParseError(e)); } }
Example #19
Source File: Request4FreshNewsCommentList.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 4 votes |
@Override protected Response<ArrayList<Comment4FreshNews>> parseNetworkResponse(NetworkResponse response) { try { String resultStr = new String(response.data, HttpHeaderParser.parseCharset(response.headers)); JSONObject resultObj = new JSONObject(resultStr); String status = resultObj.optString("status"); if (status.equals("ok")) { String commentsStr = resultObj.optJSONObject("post").optJSONArray("comments") .toString(); int id = resultObj.optJSONObject("post").optInt("id"); mCallBack.loadFinish(Integer.toString(id)); ArrayList<Comment4FreshNews> comment4FreshNewses = (ArrayList<Comment4FreshNews>) JSONParser.toObject(commentsStr, new TypeToken<ArrayList<Comment4FreshNews>>() { }.getType()); Pattern pattern = Pattern.compile("\\d{7}"); for (Comment4FreshNews comment4FreshNews : comment4FreshNewses) { Matcher matcher = pattern.matcher(comment4FreshNews.getContent()); boolean isHas7Num = matcher.find(); boolean isHasCommentStr = comment4FreshNews.getContent().contains("#comment-"); //有回复 if (isHas7Num && isHasCommentStr || comment4FreshNews.getParentId() != 0) { ArrayList<Comment4FreshNews> tempComments = new ArrayList<>(); int parentId = getParentId(comment4FreshNews.getContent()); comment4FreshNews.setParentId(parentId); getParenFreshNews(tempComments, comment4FreshNewses, parentId); Collections.reverse(tempComments); comment4FreshNews.setParentComments(tempComments); comment4FreshNews.setFloorNum(tempComments.size() + 1); comment4FreshNews.setContent(getContentWithParent(comment4FreshNews.getContent())); } else { comment4FreshNews.setContent(getContentOnlySelf(comment4FreshNews.getContent())); } } Logger.d("" + comment4FreshNewses); return Response.success(comment4FreshNewses, HttpHeaderParser .parseCacheHeaders(response)); } else { return Response.error(new ParseError(new Exception("request failed"))); } } catch (Exception e) { e.printStackTrace(); return Response.error(new ParseError(e)); } }
Example #20
Source File: FreshNewsCommentParser.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
@Nullable public ArrayList<Comment4FreshNews> parse(Response response) { code = wrapperCode(response.code()); if (!response.isSuccessful()) return null; try { String resultStr = response.body().string(); JSONObject resultObj = new JSONObject(resultStr); String status = resultObj.optString("status"); if (status.equals("ok")) { String commentsStr = resultObj.optJSONObject("post").optJSONArray("comments") .toString(); int id = resultObj.optJSONObject("post").optInt("id"); mCallBack.loadFinish(Integer.toString(id)); ArrayList<Comment4FreshNews> comment4FreshNewses = (ArrayList<Comment4FreshNews>) JSONParser.toObject(commentsStr, new TypeToken<ArrayList<Comment4FreshNews>>() { }.getType()); Pattern pattern = Pattern.compile("\\d{7}"); for (Comment4FreshNews comment4FreshNews : comment4FreshNewses) { Matcher matcher = pattern.matcher(comment4FreshNews.getContent()); boolean isHas7Num = matcher.find(); boolean isHasCommentStr = comment4FreshNews.getContent().contains("#comment-"); //有回复 if (isHas7Num && isHasCommentStr || comment4FreshNews.getParentId() != 0) { ArrayList<Comment4FreshNews> tempComments = new ArrayList<>(); int parentId = getParentId(comment4FreshNews.getContent()); comment4FreshNews.setParentId(parentId); getParenFreshNews(tempComments, comment4FreshNewses, parentId); Collections.reverse(tempComments); comment4FreshNews.setParentComments(tempComments); comment4FreshNews.setFloorNum(tempComments.size() + 1); comment4FreshNews.setContent(getContentWithParent(comment4FreshNews.getContent())); } else { comment4FreshNews.setContent(getContentOnlySelf(comment4FreshNews.getContent())); } } Logger.d("" + comment4FreshNewses); return comment4FreshNewses; } else { return null; } } catch (Exception e) { e.printStackTrace(); return null; } }
Example #21
Source File: Request4PushFreshComment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 4 votes |
public Request4PushFreshComment(String url, Response .Listener<Boolean> listener, Response.ErrorListener errorListener) { super(Method.GET, url, errorListener); Logger.d(url); this.listener = listener; }
Example #22
Source File: Request4PushFreshComment.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public Request4PushFreshComment(String url, Response .Listener<Boolean> listener, Response.ErrorListener errorListener) { super(Method.GET, url, errorListener); Logger.d(url); this.listener = listener; }
Example #23
Source File: Request4FreshNewsCommentList.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
@Override protected Response<ArrayList<Comment4FreshNews>> parseNetworkResponse(NetworkResponse response) { try { String resultStr = new String(response.data, HttpHeaderParser.parseCharset(response.headers)); JSONObject resultObj = new JSONObject(resultStr); String status = resultObj.optString("status"); if (status.equals("ok")) { String commentsStr = resultObj.optJSONObject("post").optJSONArray("comments") .toString(); int id = resultObj.optJSONObject("post").optInt("id"); mCallBack.loadFinish(Integer.toString(id)); ArrayList<Comment4FreshNews> comment4FreshNewses = (ArrayList<Comment4FreshNews>) JSONParser.toObject(commentsStr, new TypeToken<ArrayList<Comment4FreshNews>>() { }.getType()); Pattern pattern = Pattern.compile("\\d{7}"); for (Comment4FreshNews comment4FreshNews : comment4FreshNewses) { Matcher matcher = pattern.matcher(comment4FreshNews.getContent()); boolean isHas7Num = matcher.find(); boolean isHasCommentStr = comment4FreshNews.getContent().contains("#comment-"); //有回复 if (isHas7Num && isHasCommentStr || comment4FreshNews.getParentId() != 0) { ArrayList<Comment4FreshNews> tempComments = new ArrayList<>(); int parentId = getParentId(comment4FreshNews.getContent()); comment4FreshNews.setParentId(parentId); getParenFreshNews(tempComments, comment4FreshNewses, parentId); Collections.reverse(tempComments); comment4FreshNews.setParentComments(tempComments); comment4FreshNews.setFloorNum(tempComments.size() + 1); comment4FreshNews.setContent(getContentWithParent(comment4FreshNews.getContent())); } else { comment4FreshNews.setContent(getContentOnlySelf(comment4FreshNews.getContent())); } } Logger.d("" + comment4FreshNewses); return Response.success(comment4FreshNewses, HttpHeaderParser .parseCacheHeaders(response)); } else { return Response.error(new ParseError(new Exception("request failed"))); } } catch (Exception e) { e.printStackTrace(); return Response.error(new ParseError(e)); } }