```javascript
/**
* Filename: LoggerSaveManager.java
* Description:
* Copyright: Copyright (c)2015
* Company: SENRSL
* @author: senRsl senRsl@163.com
* @version: 1.0
* Create at: 2015年7月28日 下午4:17:11
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2015年7月28日 senRsl 1.0 1.0 Version
*/
package dc.common.log;
import java.util.HashMap;
import java.util.Map;
import android.content.Context;
/**
*
* @author senrsl
*
*/
public class LoggerSaveManager {
private static Map<String,LoggerSave> map = new HashMap<String, LoggerSave>();
protected static boolean isSave = false;
public static LoggerSave get(){
return get(null);
}
public static LoggerSave get(String name){
if(null == name || "".equals(name))return map.get(0);
return map.get(name);
}
public static int start(Context ctx){
isSave = true;
return create(ctx);
}
public static int start(Context ctx,String logPath,String logName){
isSave = true;
return create(ctx, logPath, logName);
}
public static int create(Context ctx){
return create(ctx, null, null);
}
public static int create(Context ctx,String logPath,String logName){
if(map.containsKey(logName))return map.size();
LoggerSave ls = new LoggerSave(ctx, logPath, logName);
map.put(logName, ls);
return map.size();
}
public static void save(String str){
save(null, str);
}
public static void save(String name,String str){
try {
map.get(name).save(str);
} catch (Exception e) {
e.printStackTrace();
}
}
private static LoggerSaveCat lsc;
public static void startCat(Context ctx){
startCat(ctx, null, null);
}
public static void startCat(Context ctx,String logPath,String logName){
try {
if(null == lsc)lsc = new LoggerSaveCat(ctx, logPath, logName);
lsc.start();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void stopCat(){
if(null != lsc)lsc.stop();
}
}
```
转:
/** * Filename: LoggerSaveManager.java * Description: * Copyright: Copyright (c)2015 * Company: SENRSL * @author: senRsl senRsl@163.com * @version: 1.0 * Create at: 2015年7月28日 下午4:17:11 * * Modification History: * Date Author Version Description * ------------------------------------------------------------------ * 2015年7月28日 senRsl 1.0 1.0 Version */ package dc.common.log; import java.util.HashMap; import java.util.Map; import android.content.Context; /** * * @author senrsl * */ public class LoggerSaveManager { private static Map<String,LoggerSave> map = new HashMap<String, LoggerSave>(); protected static boolean isSave = false; public static LoggerSave get(){ return get(null); } public static LoggerSave get(String name){ if(null == name || "".equals(name))return map.get(0); return map.get(name); } public static int start(Context ctx){ isSave = true; return create(ctx); } public static int start(Context ctx,String logPath,String logName){ isSave = true; return create(ctx, logPath, logName); } public static int create(Context ctx){ return create(ctx, null, null); } public static int create(Context ctx,String logPath,String logName){ if(map.containsKey(logName))return map.size(); LoggerSave ls = new LoggerSave(ctx, logPath, logName); map.put(logName, ls); return map.size(); } public static void save(String str){ save(null, str); } public static void save(String name,String str){ try { map.get(name).save(str); } catch (Exception e) { e.printStackTrace(); } } private static LoggerSaveCat lsc; public static void startCat(Context ctx){ startCat(ctx, null, null); } public static void startCat(Context ctx,String logPath,String logName){ try { if(null == lsc)lsc = new LoggerSaveCat(ctx, logPath, logName); lsc.start(); } catch (Exception e) { e.printStackTrace(); } } public static void stopCat(){ if(null != lsc)lsc.stop(); } }
2016年09月02日18:16:21
这个需要把\t\n\r这种换行换成<br/>,不然会被过滤掉造成所有代码都在一行,得改源码
--
senRsl
2014年11月17日16:25:44
2014年11月17日16:25:44
没有评论 :
发表评论