Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mmm-rain
AndroidUtilCode
提交
f3016188
A
AndroidUtilCode
项目概览
mmm-rain
/
AndroidUtilCode
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AndroidUtilCode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f3016188
编写于
4月 10, 2018
作者:
B
Blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 04/10 log
上级
50173f22
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
126 addition
and
115 deletion
+126
-115
utilcode/src/main/java/com/blankj/utilcode/util/CrashUtils.java
...de/src/main/java/com/blankj/utilcode/util/CrashUtils.java
+41
-26
utilcode/src/main/java/com/blankj/utilcode/util/LogUtils.java
...code/src/main/java/com/blankj/utilcode/util/LogUtils.java
+85
-89
未找到文件。
utilcode/src/main/java/com/blankj/utilcode/util/CrashUtils.java
浏览文件 @
f3016188
...
...
@@ -7,6 +7,7 @@ import android.os.Build;
import
android.os.Environment
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.RequiresPermission
;
import
android.util.Log
;
import
java.io.BufferedWriter
;
import
java.io.File
;
...
...
@@ -18,8 +19,10 @@ import java.lang.Thread.UncaughtExceptionHandler;
import
java.text.Format
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
static
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
;
...
...
@@ -38,8 +41,6 @@ public final class CrashUtils {
private
static
String
versionName
;
private
static
int
versionCode
;
private
static
ExecutorService
sExecutor
;
private
static
final
String
FILE_SEP
=
System
.
getProperty
(
"file.separator"
);
@SuppressLint
(
"SimpleDateFormat"
)
private
static
final
Format
FORMAT
=
new
SimpleDateFormat
(
"MM-dd HH-mm-ss"
);
...
...
@@ -105,30 +106,11 @@ public final class CrashUtils {
Date
now
=
new
Date
(
System
.
currentTimeMillis
());
String
fileName
=
FORMAT
.
format
(
now
)
+
".txt"
;
final
String
fullPath
=
(
dir
==
null
?
defaultDir
:
dir
)
+
fileName
;
if
(!
createOrExistsFile
(
fullPath
))
return
;
if
(
sExecutor
==
null
)
{
sExecutor
=
Executors
.
newSingleThreadExecutor
();
if
(
createOrExistsFile
(
fullPath
))
{
input2File
(
crashInfo
,
fullPath
);
}
else
{
Log
.
e
(
"CrashUtils"
,
"create "
+
fullPath
+
" failed!"
);
}
sExecutor
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
BufferedWriter
bw
=
null
;
try
{
bw
=
new
BufferedWriter
(
new
FileWriter
(
fullPath
,
false
));
bw
.
write
(
crashInfo
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
bw
!=
null
)
{
try
{
bw
.
close
();
}
catch
(
IOException
e1
)
{
e1
.
printStackTrace
();
}
}
}
}
});
if
(
sOnCrashListener
!=
null
)
{
sOnCrashListener
.
onCrash
(
crashInfo
,
e
);
...
...
@@ -229,6 +211,39 @@ public final class CrashUtils {
Thread
.
setDefaultUncaughtExceptionHandler
(
UNCAUGHT_EXCEPTION_HANDLER
);
}
private
static
void
input2File
(
final
String
input
,
final
String
filePath
)
{
Future
<
Boolean
>
submit
=
Executors
.
newSingleThreadExecutor
().
submit
(
new
Callable
<
Boolean
>()
{
@Override
public
Boolean
call
()
throws
Exception
{
BufferedWriter
bw
=
null
;
try
{
bw
=
new
BufferedWriter
(
new
FileWriter
(
filePath
,
true
));
bw
.
write
(
input
);
return
true
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
false
;
}
finally
{
try
{
if
(
bw
!=
null
)
{
bw
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
});
try
{
if
(
submit
.
get
())
return
;
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
catch
(
ExecutionException
e
)
{
e
.
printStackTrace
();
}
Log
.
e
(
"CrashUtils"
,
"write crash info to "
+
filePath
+
" failed!"
);
}
private
static
boolean
createOrExistsFile
(
final
String
filePath
)
{
File
file
=
new
File
(
filePath
);
if
(
file
.
exists
())
return
file
.
isFile
();
...
...
utilcode/src/main/java/com/blankj/utilcode/util/LogUtils.java
浏览文件 @
f3016188
...
...
@@ -85,23 +85,7 @@ public final class LogUtils {
private
static
final
String
ARGS
=
"args"
;
private
static
final
String
PLACEHOLDER
=
" "
;
private
static
final
Config
CONFIG
=
new
Config
();
private
static
ExecutorService
sExecutor
;
private
static
String
sDefaultDir
;
// The default storage directory of log.
private
static
String
sDir
;
// The storage directory of log.
private
static
String
sFilePrefix
=
"util"
;
// The file prefix of log.
private
static
boolean
sLogSwitch
=
true
;
// The switch of log.
private
static
boolean
sLog2ConsoleSwitch
=
true
;
// The logcat's switch of log.
private
static
String
sGlobalTag
=
null
;
// The global tag of log.
private
static
boolean
sTagIsSpace
=
true
;
// The global tag is space.
private
static
boolean
sLogHeadSwitch
=
true
;
// The head's switch of log.
private
static
boolean
sLog2FileSwitch
=
false
;
// The file's switch of log.
private
static
boolean
sLogBorderSwitch
=
true
;
// The border's switch of log.
private
static
boolean
sSingleTagSwitch
=
true
;
// The single tag of log.
private
static
int
sConsoleFilter
=
V
;
// The console's filter of log.
private
static
int
sFileFilter
=
V
;
// The file's filter of log.
private
static
int
sStackDeep
=
1
;
// The stack's deep of log.
private
LogUtils
()
{
throw
new
UnsupportedOperationException
(
"u can't instantiate me..."
);
...
...
@@ -112,7 +96,7 @@ public final class LogUtils {
}
public
static
void
v
(
final
Object
...
contents
)
{
log
(
V
,
s
GlobalTag
,
contents
);
log
(
V
,
CONFIG
.
m
GlobalTag
,
contents
);
}
public
static
void
vTag
(
final
String
tag
,
final
Object
...
contents
)
{
...
...
@@ -120,7 +104,7 @@ public final class LogUtils {
}
public
static
void
d
(
final
Object
...
contents
)
{
log
(
D
,
s
GlobalTag
,
contents
);
log
(
D
,
CONFIG
.
m
GlobalTag
,
contents
);
}
public
static
void
dTag
(
final
String
tag
,
final
Object
...
contents
)
{
...
...
@@ -128,7 +112,7 @@ public final class LogUtils {
}
public
static
void
i
(
final
Object
...
contents
)
{
log
(
I
,
s
GlobalTag
,
contents
);
log
(
I
,
CONFIG
.
m
GlobalTag
,
contents
);
}
public
static
void
iTag
(
final
String
tag
,
final
Object
...
contents
)
{
...
...
@@ -136,7 +120,7 @@ public final class LogUtils {
}
public
static
void
w
(
final
Object
...
contents
)
{
log
(
W
,
s
GlobalTag
,
contents
);
log
(
W
,
CONFIG
.
m
GlobalTag
,
contents
);
}
public
static
void
wTag
(
final
String
tag
,
final
Object
...
contents
)
{
...
...
@@ -144,7 +128,7 @@ public final class LogUtils {
}
public
static
void
e
(
final
Object
...
contents
)
{
log
(
E
,
s
GlobalTag
,
contents
);
log
(
E
,
CONFIG
.
m
GlobalTag
,
contents
);
}
public
static
void
eTag
(
final
String
tag
,
final
Object
...
contents
)
{
...
...
@@ -152,7 +136,7 @@ public final class LogUtils {
}
public
static
void
a
(
final
Object
...
contents
)
{
log
(
A
,
s
GlobalTag
,
contents
);
log
(
A
,
CONFIG
.
m
GlobalTag
,
contents
);
}
public
static
void
aTag
(
final
String
tag
,
final
Object
...
contents
)
{
...
...
@@ -160,11 +144,11 @@ public final class LogUtils {
}
public
static
void
file
(
final
Object
content
)
{
log
(
FILE
|
D
,
s
GlobalTag
,
content
);
log
(
FILE
|
D
,
CONFIG
.
m
GlobalTag
,
content
);
}
public
static
void
file
(
@TYPE
final
int
type
,
final
Object
content
)
{
log
(
FILE
|
type
,
s
GlobalTag
,
content
);
log
(
FILE
|
type
,
CONFIG
.
m
GlobalTag
,
content
);
}
public
static
void
file
(
final
String
tag
,
final
Object
content
)
{
...
...
@@ -176,11 +160,11 @@ public final class LogUtils {
}
public
static
void
json
(
final
String
content
)
{
log
(
JSON
|
D
,
s
GlobalTag
,
content
);
log
(
JSON
|
D
,
CONFIG
.
m
GlobalTag
,
content
);
}
public
static
void
json
(
@TYPE
final
int
type
,
final
String
content
)
{
log
(
JSON
|
type
,
s
GlobalTag
,
content
);
log
(
JSON
|
type
,
CONFIG
.
m
GlobalTag
,
content
);
}
public
static
void
json
(
final
String
tag
,
final
String
content
)
{
...
...
@@ -192,11 +176,11 @@ public final class LogUtils {
}
public
static
void
xml
(
final
String
content
)
{
log
(
XML
|
D
,
s
GlobalTag
,
content
);
log
(
XML
|
D
,
CONFIG
.
m
GlobalTag
,
content
);
}
public
static
void
xml
(
@TYPE
final
int
type
,
final
String
content
)
{
log
(
XML
|
type
,
s
GlobalTag
,
content
);
log
(
XML
|
type
,
CONFIG
.
m
GlobalTag
,
content
);
}
public
static
void
xml
(
final
String
tag
,
final
String
content
)
{
...
...
@@ -208,31 +192,31 @@ public final class LogUtils {
}
private
static
void
log
(
final
int
type
,
final
String
tag
,
final
Object
...
contents
)
{
if
(!
sLogSwitch
||
(!
sLog2ConsoleSwitch
&&
!
s
Log2FileSwitch
))
return
;
if
(!
CONFIG
.
mLogSwitch
||
(!
CONFIG
.
mLog2ConsoleSwitch
&&
!
CONFIG
.
m
Log2FileSwitch
))
return
;
int
type_low
=
type
&
0x0f
,
type_high
=
type
&
0xf0
;
if
(
type_low
<
sConsoleFilter
&&
type_low
<
s
FileFilter
)
return
;
if
(
type_low
<
CONFIG
.
mConsoleFilter
&&
type_low
<
CONFIG
.
m
FileFilter
)
return
;
final
TagHead
tagHead
=
processTagAndHead
(
tag
);
String
body
=
processBody
(
type_high
,
contents
);
if
(
sLog2ConsoleSwitch
&&
type_low
>=
s
ConsoleFilter
&&
type_high
!=
FILE
)
{
if
(
CONFIG
.
mLog2ConsoleSwitch
&&
type_low
>=
CONFIG
.
m
ConsoleFilter
&&
type_high
!=
FILE
)
{
print2Console
(
type_low
,
tagHead
.
tag
,
tagHead
.
consoleHead
,
body
);
}
if
((
sLog2FileSwitch
||
type_high
==
FILE
)
&&
type_low
>=
s
FileFilter
)
{
if
((
CONFIG
.
mLog2FileSwitch
||
type_high
==
FILE
)
&&
type_low
>=
CONFIG
.
m
FileFilter
)
{
print2File
(
type_low
,
tagHead
.
tag
,
tagHead
.
fileHead
+
body
);
}
}
private
static
TagHead
processTagAndHead
(
String
tag
)
{
if
(!
sTagIsSpace
&&
!
s
LogHeadSwitch
)
{
tag
=
s
GlobalTag
;
if
(!
CONFIG
.
mTagIsSpace
&&
!
CONFIG
.
m
LogHeadSwitch
)
{
tag
=
CONFIG
.
m
GlobalTag
;
}
else
{
final
StackTraceElement
[]
stackTrace
=
new
Throwable
().
getStackTrace
();
StackTraceElement
targetElement
=
stackTrace
[
3
];
final
String
fileName
=
getFileName
(
targetElement
);
if
(
s
TagIsSpace
&&
isSpace
(
tag
))
{
if
(
CONFIG
.
m
TagIsSpace
&&
isSpace
(
tag
))
{
int
index
=
fileName
.
indexOf
(
'.'
);
// Use proguard may not find '.'.
tag
=
index
==
-
1
?
fileName
:
fileName
.
substring
(
0
,
index
);
}
if
(
s
LogHeadSwitch
)
{
if
(
CONFIG
.
m
LogHeadSwitch
)
{
String
tName
=
Thread
.
currentThread
().
getName
();
final
String
head
=
new
Formatter
()
.
format
(
"%s, %s.%s(%s:%d)"
,
...
...
@@ -243,11 +227,11 @@ public final class LogUtils {
targetElement
.
getLineNumber
())
.
toString
();
final
String
fileHead
=
" ["
+
head
+
"]: "
;
if
(
s
StackDeep
<=
1
)
{
if
(
CONFIG
.
m
StackDeep
<=
1
)
{
return
new
TagHead
(
tag
,
new
String
[]{
head
},
fileHead
);
}
else
{
final
String
[]
consoleHead
=
new
String
[
Math
.
min
(
s
StackDeep
,
stackTrace
.
length
-
3
)];
new
String
[
Math
.
min
(
CONFIG
.
m
StackDeep
,
stackTrace
.
length
-
3
)];
consoleHead
[
0
]
=
head
;
int
spaceLen
=
tName
.
length
()
+
2
;
String
space
=
new
Formatter
().
format
(
"%"
+
spaceLen
+
"s"
,
""
).
toString
();
...
...
@@ -347,10 +331,10 @@ public final class LogUtils {
final
String
tag
,
final
String
[]
head
,
final
String
msg
)
{
if
(
s
SingleTagSwitch
)
{
if
(
CONFIG
.
m
SingleTagSwitch
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
PLACEHOLDER
).
append
(
LINE_SEP
);
if
(
s
LogBorderSwitch
)
{
if
(
CONFIG
.
m
LogBorderSwitch
)
{
sb
.
append
(
TOP_BORDER
).
append
(
LINE_SEP
);
for
(
String
aHead
:
head
)
{
sb
.
append
(
LEFT_BORDER
).
append
(
aHead
).
append
(
LINE_SEP
);
...
...
@@ -376,7 +360,7 @@ public final class LogUtils {
}
private
static
void
printBorder
(
final
int
type
,
final
String
tag
,
boolean
isTop
)
{
if
(
s
LogBorderSwitch
)
{
if
(
CONFIG
.
m
LogBorderSwitch
)
{
Log
.
println
(
type
,
tag
,
isTop
?
TOP_BORDER
:
BOTTOM_BORDER
);
}
}
...
...
@@ -384,9 +368,9 @@ public final class LogUtils {
private
static
void
printHead
(
final
int
type
,
final
String
tag
,
final
String
[]
head
)
{
if
(
head
!=
null
)
{
for
(
String
aHead
:
head
)
{
Log
.
println
(
type
,
tag
,
s
LogBorderSwitch
?
LEFT_BORDER
+
aHead
:
aHead
);
Log
.
println
(
type
,
tag
,
CONFIG
.
m
LogBorderSwitch
?
LEFT_BORDER
+
aHead
:
aHead
);
}
if
(
s
LogBorderSwitch
)
Log
.
println
(
type
,
tag
,
MIDDLE_BORDER
);
if
(
CONFIG
.
m
LogBorderSwitch
)
Log
.
println
(
type
,
tag
,
MIDDLE_BORDER
);
}
}
...
...
@@ -411,7 +395,7 @@ public final class LogUtils {
int
len
=
msg
.
length
();
int
countOfSub
=
len
/
MAX_LEN
;
if
(
countOfSub
>
0
)
{
if
(
s
LogBorderSwitch
)
{
if
(
CONFIG
.
m
LogBorderSwitch
)
{
Log
.
println
(
type
,
tag
,
msg
.
substring
(
0
,
MAX_LEN
)
+
LINE_SEP
+
BOTTOM_BORDER
);
int
index
=
MAX_LEN
;
for
(
int
i
=
1
;
i
<
countOfSub
;
i
++)
{
...
...
@@ -440,7 +424,7 @@ public final class LogUtils {
}
private
static
void
printSubMsg
(
final
int
type
,
final
String
tag
,
final
String
msg
)
{
if
(!
s
LogBorderSwitch
)
{
if
(!
CONFIG
.
m
LogBorderSwitch
)
{
Log
.
println
(
type
,
tag
,
msg
);
return
;
}
...
...
@@ -452,7 +436,7 @@ public final class LogUtils {
}
private
static
void
printSubMsg1
(
final
int
type
,
final
String
tag
,
final
String
msg
)
{
if
(!
s
LogBorderSwitch
)
{
if
(!
CONFIG
.
m
LogBorderSwitch
)
{
return
;
}
...
...
@@ -469,9 +453,10 @@ public final class LogUtils {
String
date
=
format
.
substring
(
0
,
5
);
String
time
=
format
.
substring
(
6
);
final
String
fullPath
=
(
sDir
==
null
?
sDefaultDir
:
sDir
)
+
sFilePrefix
+
"-"
+
date
+
".txt"
;
(
CONFIG
.
mDir
==
null
?
CONFIG
.
mDefaultDir
:
CONFIG
.
mDir
)
+
CONFIG
.
mFilePrefix
+
"-"
+
date
+
".txt"
;
if
(!
createOrExistsFile
(
fullPath
))
{
Log
.
e
(
tag
,
"log to
"
+
fullPath
+
" failed!"
);
Log
.
e
(
"LogUtils"
,
"create
"
+
fullPath
+
" failed!"
);
return
;
}
StringBuilder
sb
=
new
StringBuilder
();
...
...
@@ -482,11 +467,7 @@ public final class LogUtils {
.
append
(
msg
)
.
append
(
LINE_SEP
);
final
String
content
=
sb
.
toString
();
if
(
input2File
(
content
,
fullPath
))
{
Log
.
d
(
tag
,
"log to "
+
fullPath
+
" success!"
);
}
else
{
Log
.
e
(
tag
,
"log to "
+
fullPath
+
" failed!"
);
}
input2File
(
content
,
fullPath
);
}
private
static
boolean
createOrExistsFile
(
final
String
filePath
)
{
...
...
@@ -542,7 +523,7 @@ public final class LogUtils {
return
true
;
}
private
static
boolean
input2File
(
final
String
input
,
final
String
filePath
)
{
private
static
void
input2File
(
final
String
input
,
final
String
filePath
)
{
if
(
sExecutor
==
null
)
{
sExecutor
=
Executors
.
newSingleThreadExecutor
();
}
...
...
@@ -569,119 +550,134 @@ public final class LogUtils {
}
});
try
{
return
submit
.
get
()
;
if
(
submit
.
get
())
return
;
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
catch
(
ExecutionException
e
)
{
e
.
printStackTrace
();
}
return
false
;
Log
.
e
(
"LogUtils"
,
"log to "
+
filePath
+
" failed!"
)
;
}
public
static
class
Config
{
private
String
mDefaultDir
;
// The default storage directory of log.
private
String
mDir
;
// The storage directory of log.
private
String
mFilePrefix
=
"util"
;
// The file prefix of log.
private
boolean
mLogSwitch
=
true
;
// The switch of log.
private
boolean
mLog2ConsoleSwitch
=
true
;
// The logcat's switch of log.
private
String
mGlobalTag
=
null
;
// The global tag of log.
private
boolean
mTagIsSpace
=
true
;
// The global tag is space.
private
boolean
mLogHeadSwitch
=
true
;
// The head's switch of log.
private
boolean
mLog2FileSwitch
=
false
;
// The file's switch of log.
private
boolean
mLogBorderSwitch
=
true
;
// The border's switch of log.
private
boolean
mSingleTagSwitch
=
true
;
// The single tag of log.
private
int
mConsoleFilter
=
V
;
// The console's filter of log.
private
int
mFileFilter
=
V
;
// The file's filter of log.
private
int
mStackDeep
=
1
;
// The stack's deep of log.
private
Config
()
{
if
(
s
DefaultDir
!=
null
)
return
;
if
(
m
DefaultDir
!=
null
)
return
;
if
(
Environment
.
MEDIA_MOUNTED
.
equals
(
Environment
.
getExternalStorageState
())
&&
Utils
.
getApp
().
getExternalCacheDir
()
!=
null
)
s
DefaultDir
=
Utils
.
getApp
().
getExternalCacheDir
()
+
FILE_SEP
+
"log"
+
FILE_SEP
;
m
DefaultDir
=
Utils
.
getApp
().
getExternalCacheDir
()
+
FILE_SEP
+
"log"
+
FILE_SEP
;
else
{
s
DefaultDir
=
Utils
.
getApp
().
getCacheDir
()
+
FILE_SEP
+
"log"
+
FILE_SEP
;
m
DefaultDir
=
Utils
.
getApp
().
getCacheDir
()
+
FILE_SEP
+
"log"
+
FILE_SEP
;
}
}
public
Config
setLogSwitch
(
final
boolean
logSwitch
)
{
s
LogSwitch
=
logSwitch
;
m
LogSwitch
=
logSwitch
;
return
this
;
}
public
Config
setConsoleSwitch
(
final
boolean
consoleSwitch
)
{
s
Log2ConsoleSwitch
=
consoleSwitch
;
m
Log2ConsoleSwitch
=
consoleSwitch
;
return
this
;
}
public
Config
setGlobalTag
(
final
String
tag
)
{
if
(
isSpace
(
tag
))
{
s
GlobalTag
=
""
;
s
TagIsSpace
=
true
;
m
GlobalTag
=
""
;
m
TagIsSpace
=
true
;
}
else
{
s
GlobalTag
=
tag
;
s
TagIsSpace
=
false
;
m
GlobalTag
=
tag
;
m
TagIsSpace
=
false
;
}
return
this
;
}
public
Config
setLogHeadSwitch
(
final
boolean
logHeadSwitch
)
{
s
LogHeadSwitch
=
logHeadSwitch
;
m
LogHeadSwitch
=
logHeadSwitch
;
return
this
;
}
public
Config
setLog2FileSwitch
(
final
boolean
log2FileSwitch
)
{
s
Log2FileSwitch
=
log2FileSwitch
;
m
Log2FileSwitch
=
log2FileSwitch
;
return
this
;
}
public
Config
setDir
(
final
String
dir
)
{
if
(
isSpace
(
dir
))
{
s
Dir
=
null
;
m
Dir
=
null
;
}
else
{
s
Dir
=
dir
.
endsWith
(
FILE_SEP
)
?
dir
:
dir
+
FILE_SEP
;
m
Dir
=
dir
.
endsWith
(
FILE_SEP
)
?
dir
:
dir
+
FILE_SEP
;
}
return
this
;
}
public
Config
setDir
(
final
File
dir
)
{
s
Dir
=
dir
==
null
?
null
:
dir
.
getAbsolutePath
()
+
FILE_SEP
;
m
Dir
=
dir
==
null
?
null
:
dir
.
getAbsolutePath
()
+
FILE_SEP
;
return
this
;
}
public
Config
setFilePrefix
(
final
String
filePrefix
)
{
if
(
isSpace
(
filePrefix
))
{
s
FilePrefix
=
"util"
;
m
FilePrefix
=
"util"
;
}
else
{
s
FilePrefix
=
filePrefix
;
m
FilePrefix
=
filePrefix
;
}
return
this
;
}
public
Config
setBorderSwitch
(
final
boolean
borderSwitch
)
{
s
LogBorderSwitch
=
borderSwitch
;
m
LogBorderSwitch
=
borderSwitch
;
return
this
;
}
public
Config
setSingleTagSwitch
(
final
boolean
singleTagSwitch
)
{
s
SingleTagSwitch
=
singleTagSwitch
;
m
SingleTagSwitch
=
singleTagSwitch
;
return
this
;
}
public
Config
setConsoleFilter
(
@TYPE
final
int
consoleFilter
)
{
s
ConsoleFilter
=
consoleFilter
;
m
ConsoleFilter
=
consoleFilter
;
return
this
;
}
public
Config
setFileFilter
(
@TYPE
final
int
fileFilter
)
{
s
FileFilter
=
fileFilter
;
m
FileFilter
=
fileFilter
;
return
this
;
}
public
Config
setStackDeep
(
@IntRange
(
from
=
1
)
final
int
stackDeep
)
{
s
StackDeep
=
stackDeep
;
m
StackDeep
=
stackDeep
;
return
this
;
}
@Override
public
String
toString
()
{
return
"switch: "
+
s
LogSwitch
+
LINE_SEP
+
"console: "
+
s
Log2ConsoleSwitch
+
LINE_SEP
+
"tag: "
+
(
sTagIsSpace
?
"null"
:
s
GlobalTag
)
+
LINE_SEP
+
"head: "
+
s
LogHeadSwitch
+
LINE_SEP
+
"file: "
+
s
Log2FileSwitch
+
LINE_SEP
+
"dir: "
+
(
sDir
==
null
?
sDefaultDir
:
s
Dir
)
+
LINE_SEP
+
"filePrefix: "
+
s
FilePrefix
+
LINE_SEP
+
"border: "
+
s
LogBorderSwitch
+
LINE_SEP
+
"singleTag: "
+
s
SingleTagSwitch
+
LINE_SEP
+
"consoleFilter: "
+
T
[
s
ConsoleFilter
-
V
]
+
LINE_SEP
+
"fileFilter: "
+
T
[
s
FileFilter
-
V
]
+
LINE_SEP
+
"stackDeep: "
+
s
StackDeep
;
return
"switch: "
+
m
LogSwitch
+
LINE_SEP
+
"console: "
+
m
Log2ConsoleSwitch
+
LINE_SEP
+
"tag: "
+
(
mTagIsSpace
?
"null"
:
m
GlobalTag
)
+
LINE_SEP
+
"head: "
+
m
LogHeadSwitch
+
LINE_SEP
+
"file: "
+
m
Log2FileSwitch
+
LINE_SEP
+
"dir: "
+
(
mDir
==
null
?
mDefaultDir
:
m
Dir
)
+
LINE_SEP
+
"filePrefix: "
+
m
FilePrefix
+
LINE_SEP
+
"border: "
+
m
LogBorderSwitch
+
LINE_SEP
+
"singleTag: "
+
m
SingleTagSwitch
+
LINE_SEP
+
"consoleFilter: "
+
T
[
m
ConsoleFilter
-
V
]
+
LINE_SEP
+
"fileFilter: "
+
T
[
m
FileFilter
-
V
]
+
LINE_SEP
+
"stackDeep: "
+
m
StackDeep
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录