Skip to content

Commit

Permalink
1.Add android crash logs handler.
Browse files Browse the repository at this point in the history
2.Update documents.
  • Loading branch information
liulhdarks committed Mar 27, 2014
1 parent 230f999 commit 7a5f90c
Show file tree
Hide file tree
Showing 231 changed files with 2,308 additions and 692 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,39 @@ Example:<br/>
}
}
</pre>
If you want to catch android ANR crash logs automatically, you can register crash handler.
Parameter callback can be called after ANR happened.<br>
Example:
<pre>
Logger.Android.setApplication(this, true);
</pre>
Or
<pre>
Logger.Android.setApplication(this);
Logger.Android.registerCrashHandler();
</pre>
Or
<pre>
Logger.Android.setApplication(this);
Logger.Android.registerCrashHandler(new CallBack(){
@Override
public boolean handleMessage(Message msg)
{
new Thread()
{
public void run()
{
Looper.prepare();
Toast.makeText(CustomApplication.this, "The crash has happened.", Toast.LENGTH_LONG).show();
Looper.loop();
}
}.start();
Thread.sleep(3000);
return true;
}
});
</pre>

After logd.properties created, we can configure it for logger.

### Customize Config Loader
Expand Down
Binary file modified bin/darks/log/AndroidConfig.class
Binary file not shown.
Binary file modified bin/darks/log/Logger.class
Binary file not shown.
8 changes: 6 additions & 2 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed Mar 26 23:50:46 CST 2014 -->
<!-- Generated by javadoc (build 1.6.0_14) on Thu Mar 27 23:12:06 CST 2014 -->
<TITLE>
所有类
</TITLE>

<META NAME="date" CONTENT="2014-03-26">
<META NAME="date" CONTENT="2014-03-27">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand All @@ -25,6 +25,8 @@
<BR>
<A HREF="darks/log/AndroidConfig.html" title="darks.log 中的类" target="classFrame">AndroidConfig</A>
<BR>
<A HREF="darks/log/externs/AndroidCrashHandler.html" title="darks.log.externs 中的类" target="classFrame">AndroidCrashHandler</A>
<BR>
<A HREF="darks/log/utils/time/AndroidDateFormater.html" title="darks.log.utils.time 中的类" target="classFrame">AndroidDateFormater</A>
<BR>
<A HREF="darks/log/kernel/AndroidKernelLogger.html" title="darks.log.kernel 中的类" target="classFrame">AndroidKernelLogger</A>
Expand Down Expand Up @@ -83,6 +85,8 @@
<BR>
<A HREF="darks/log/Level.html" title="darks.log 中的类" target="classFrame">Level</A>
<BR>
<A HREF="darks/log/filter/LevelMatchFilter.html" title="darks.log.filter 中的类" target="classFrame">LevelMatchFilter</A>
<BR>
<A HREF="darks/log/filter/LevelRangeFilter.html" title="darks.log.filter 中的类" target="classFrame">LevelRangeFilter</A>
<BR>
<A HREF="darks/log/loader/Loader.html" title="darks.log.loader 中的类" target="classFrame">Loader</A>
Expand Down
8 changes: 6 additions & 2 deletions docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed Mar 26 23:50:46 CST 2014 -->
<!-- Generated by javadoc (build 1.6.0_14) on Thu Mar 27 23:12:06 CST 2014 -->
<TITLE>
所有类
</TITLE>

<META NAME="date" CONTENT="2014-03-26">
<META NAME="date" CONTENT="2014-03-27">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand All @@ -25,6 +25,8 @@
<BR>
<A HREF="darks/log/AndroidConfig.html" title="darks.log 中的类">AndroidConfig</A>
<BR>
<A HREF="darks/log/externs/AndroidCrashHandler.html" title="darks.log.externs 中的类">AndroidCrashHandler</A>
<BR>
<A HREF="darks/log/utils/time/AndroidDateFormater.html" title="darks.log.utils.time 中的类">AndroidDateFormater</A>
<BR>
<A HREF="darks/log/kernel/AndroidKernelLogger.html" title="darks.log.kernel 中的类">AndroidKernelLogger</A>
Expand Down Expand Up @@ -83,6 +85,8 @@
<BR>
<A HREF="darks/log/Level.html" title="darks.log 中的类">Level</A>
<BR>
<A HREF="darks/log/filter/LevelMatchFilter.html" title="darks.log.filter 中的类">LevelMatchFilter</A>
<BR>
<A HREF="darks/log/filter/LevelRangeFilter.html" title="darks.log.filter 中的类">LevelRangeFilter</A>
<BR>
<A HREF="darks/log/loader/Loader.html" title="darks.log.loader 中的类">Loader</A>
Expand Down
4 changes: 2 additions & 2 deletions docs/constant-values.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed Mar 26 23:50:46 CST 2014 -->
<!-- Generated by javadoc (build 1.6.0_14) on Thu Mar 27 23:12:06 CST 2014 -->
<TITLE>
常量字段值
</TITLE>

<META NAME="date" CONTENT="2014-03-26">
<META NAME="date" CONTENT="2014-03-27">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
77 changes: 74 additions & 3 deletions docs/darks/log/AndroidConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed Mar 26 23:50:45 CST 2014 -->
<!-- Generated by javadoc (build 1.6.0_14) on Thu Mar 27 23:12:05 CST 2014 -->
<TITLE>
AndroidConfig
</TITLE>

<META NAME="date" CONTENT="2014-03-26">
<META NAME="date" CONTENT="2014-03-27">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -143,11 +143,36 @@ <H2>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../darks/log/AndroidConfig.html#registerCrashHandler()">registerCrashHandler</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Register crash handler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../darks/log/AndroidConfig.html#registerCrashHandler(android.os.Handler.Callback)">registerCrashHandler</A></B>(android.os.Handler.Callback&nbsp;callback)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Register crash handler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../darks/log/AndroidConfig.html#setApplication(android.app.Application)">setApplication</A></B>(android.app.Application&nbsp;application)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../darks/log/AndroidConfig.html#setApplication(android.app.Application, boolean)">setApplication</A></B>(android.app.Application&nbsp;application,
boolean&nbsp;regCrash)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set android application</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
Expand Down Expand Up @@ -191,7 +216,39 @@ <H2>
<P>
<DD><DL>

<DT><B>返回:</B><DD>If succeed to get loader, return loader object. Otherwise return null;.</DL>
<DT><B>返回:</B><DD>If succeed to get loader, return loader object. Otherwise return
null;.</DL>
</DD>
</DL>
<HR>

<A NAME="registerCrashHandler()"><!-- --></A><H3>
registerCrashHandler</H3>
<PRE>
public void <B>registerCrashHandler</B>()</PRE>
<DL>
<DD>Register crash handler. It can catch ANR error automatically and use
logger to output message. <br>
You can use registerCrashHandler(Callback callback) to register the callback.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="registerCrashHandler(android.os.Handler.Callback)"><!-- --></A><H3>
registerCrashHandler</H3>
<PRE>
public void <B>registerCrashHandler</B>(android.os.Handler.Callback&nbsp;callback)</PRE>
<DL>
<DD>Register crash handler. It can catch ANR error automatically and use
logger to output message.
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>callback</CODE> - Call back object.When ANR error happened, it will use
callback to notify developers. If it's null, it won't call
back.</DL>
</DD>
</DL>
<HR>
Expand All @@ -205,6 +262,20 @@ <H2>
</DL>
</DD>
</DL>
<HR>

<A NAME="setApplication(android.app.Application, boolean)"><!-- --></A><H3>
setApplication</H3>
<PRE>
public void <B>setApplication</B>(android.app.Application&nbsp;application,
boolean&nbsp;regCrash)</PRE>
<DL>
<DD>Set android application
<P>
<DD><DL>
<DT><B>参数:</B><DD><CODE>application</CODE> - Android application<DD><CODE>regCrash</CODE> - If true, it will register crash logger's crash handler</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>

Expand Down
4 changes: 2 additions & 2 deletions docs/darks/log/Category.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed Mar 26 23:50:45 CST 2014 -->
<!-- Generated by javadoc (build 1.6.0_14) on Thu Mar 27 23:12:05 CST 2014 -->
<TITLE>
Category
</TITLE>

<META NAME="date" CONTENT="2014-03-26">
<META NAME="date" CONTENT="2014-03-27">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down
19 changes: 8 additions & 11 deletions docs/darks/log/DefaultLogger.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed Mar 26 23:50:45 CST 2014 -->
<!-- Generated by javadoc (build 1.6.0_14) on Thu Mar 27 23:12:05 CST 2014 -->
<TITLE>
DefaultLogger
</TITLE>

<META NAME="date" CONTENT="2014-03-26">
<META NAME="date" CONTENT="2014-03-27">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -163,8 +163,7 @@ <H2>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../darks/log/DefaultLogger.html#addAppender(darks.log.appender.Appender, boolean)">addAppender</A></B>(<A HREF="../../darks/log/appender/Appender.html" title="darks.log.appender 中的类">Appender</A>&nbsp;appender,
boolean&nbsp;rooted)</CODE>
<TD><CODE><B><A HREF="../../darks/log/DefaultLogger.html#addAppender(darks.log.appender.Appender)">addAppender</A></B>(<A HREF="../../darks/log/appender/Appender.html" title="darks.log.appender 中的类">Appender</A>&nbsp;appender)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add appender object</TD>
Expand Down Expand Up @@ -219,7 +218,7 @@ <H2>
<TH ALIGN="left"><B>从类 darks.log.<A HREF="../../darks/log/Logger.html" title="darks.log 中的类">Logger</A> 继承的方法</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../darks/log/Logger.html#append()">append</A>, <A HREF="../../darks/log/Logger.html#append(java.lang.Object)">append</A>, <A HREF="../../darks/log/Logger.html#buffer(java.lang.Object...)">buffer</A>, <A HREF="../../darks/log/Logger.html#debug(java.lang.Object)">debug</A>, <A HREF="../../darks/log/Logger.html#debug(java.lang.Object, java.lang.Throwable)">debug</A>, <A HREF="../../darks/log/Logger.html#error(java.lang.Object)">error</A>, <A HREF="../../darks/log/Logger.html#error(java.lang.Object, java.lang.Throwable)">error</A>, <A HREF="../../darks/log/Logger.html#format(java.lang.String, java.lang.Object...)">format</A>, <A HREF="../../darks/log/Logger.html#getLogger(java.lang.Class)">getLogger</A>, <A HREF="../../darks/log/Logger.html#getLogger(java.lang.String)">getLogger</A>, <A HREF="../../darks/log/Logger.html#info(java.lang.Object)">info</A>, <A HREF="../../darks/log/Logger.html#info(java.lang.Object, java.lang.Throwable)">info</A>, <A HREF="../../darks/log/Logger.html#log(darks.log.Level, java.lang.Object)">log</A>, <A HREF="../../darks/log/Logger.html#trace(java.lang.Object)">trace</A>, <A HREF="../../darks/log/Logger.html#trace(java.lang.Object, java.lang.Throwable)">trace</A>, <A HREF="../../darks/log/Logger.html#verbose(java.lang.Object)">verbose</A>, <A HREF="../../darks/log/Logger.html#verbose(java.lang.Object, java.lang.Throwable)">verbose</A>, <A HREF="../../darks/log/Logger.html#warn(java.lang.Object)">warn</A>, <A HREF="../../darks/log/Logger.html#warn(java.lang.Object, java.lang.Throwable)">warn</A></CODE></TD>
<TD><CODE><A HREF="../../darks/log/Logger.html#append()">append</A>, <A HREF="../../darks/log/Logger.html#append(java.lang.Object)">append</A>, <A HREF="../../darks/log/Logger.html#buffer(java.lang.Object...)">buffer</A>, <A HREF="../../darks/log/Logger.html#debug(java.lang.Object)">debug</A>, <A HREF="../../darks/log/Logger.html#debug(java.lang.Object, java.lang.Throwable)">debug</A>, <A HREF="../../darks/log/Logger.html#error(java.lang.Object)">error</A>, <A HREF="../../darks/log/Logger.html#error(java.lang.Object, java.lang.Throwable)">error</A>, <A HREF="../../darks/log/Logger.html#format(java.lang.String, java.lang.Object...)">format</A>, <A HREF="../../darks/log/Logger.html#getLogger(java.lang.Class)">getLogger</A>, <A HREF="../../darks/log/Logger.html#getLogger(java.lang.String)">getLogger</A>, <A HREF="../../darks/log/Logger.html#getRootLogger()">getRootLogger</A>, <A HREF="../../darks/log/Logger.html#info(java.lang.Object)">info</A>, <A HREF="../../darks/log/Logger.html#info(java.lang.Object, java.lang.Throwable)">info</A>, <A HREF="../../darks/log/Logger.html#log(darks.log.Level, java.lang.Object)">log</A>, <A HREF="../../darks/log/Logger.html#trace(java.lang.Object)">trace</A>, <A HREF="../../darks/log/Logger.html#trace(java.lang.Object, java.lang.Throwable)">trace</A>, <A HREF="../../darks/log/Logger.html#verbose(java.lang.Object)">verbose</A>, <A HREF="../../darks/log/Logger.html#verbose(java.lang.Object, java.lang.Throwable)">verbose</A>, <A HREF="../../darks/log/Logger.html#warn(java.lang.Object)">warn</A>, <A HREF="../../darks/log/Logger.html#warn(java.lang.Object, java.lang.Throwable)">warn</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
Expand Down Expand Up @@ -262,20 +261,18 @@ <H2>
</TR>
</TABLE>

<A NAME="addAppender(darks.log.appender.Appender, boolean)"><!-- --></A><H3>
<A NAME="addAppender(darks.log.appender.Appender)"><!-- --></A><H3>
addAppender</H3>
<PRE>
public void <B>addAppender</B>(<A HREF="../../darks/log/appender/Appender.html" title="darks.log.appender 中的类">Appender</A>&nbsp;appender,
boolean&nbsp;rooted)</PRE>
public void <B>addAppender</B>(<A HREF="../../darks/log/appender/Appender.html" title="darks.log.appender 中的类">Appender</A>&nbsp;appender)</PRE>
<DL>
<DD>Add appender object
<P>
<DD><DL>
<DT><B>指定者:</B><DD><CODE><A HREF="../../darks/log/Logger.html" title="darks.log 中的类">Logger</A></CODE> 中的 <CODE><A HREF="../../darks/log/Logger.html#addAppender(darks.log.appender.Appender, boolean)">addAppender</A></CODE></DL>
<DT><B>指定者:</B><DD><CODE><A HREF="../../darks/log/Logger.html" title="darks.log 中的类">Logger</A></CODE> 中的 <CODE><A HREF="../../darks/log/Logger.html#addAppender(darks.log.appender.Appender)">addAppender</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>参数:</B><DD><CODE>appender</CODE> - Appender object<DD><CODE>rooted</CODE> - If true, appender will be added to root logger. otherwise
be added to current logger.</DL>
<DT><B>参数:</B><DD><CODE>appender</CODE> - Appender object</DL>
</DD>
</DL>
<HR>
Expand Down
Loading

0 comments on commit 7a5f90c

Please sign in to comment.