Android Open Source - ILog Logging Test






From Project

Back to project page ILog.

License

The source code is released under:

GNU General Public License

If you think the Android project ILog listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.moshx.jvmsample;
/* w ww .  jav  a  2 s  .co m*/
import java.io.File;
import java.net.URL;

import com.moshx.ilog.ILog;
import com.moshx.ilog.filelogger.HtmlFileLogger;

public class LoggingTest {

  public static void main(String[] args) {

    ILog log = new ILog();
    log.d(); // will print current class + method
    log.i("am here"); // will print passed message
    log.e("erro :O");
    log.v();

    log.setFileLogger(new HtmlFileLogger()).getFileLogger()
        .createLogFile(getLoggingFile());
    log.d();
    log.d(1000);
    log.getFileLogger().onEnd();

    new AnotherTestClass().test();

  }

  private static File getLoggingFile() {
    URL location = LoggingTest.class.getProtectionDomain().getCodeSource()
        .getLocation();
    return new File(location.getFile()).getParentFile();
  }

  public static class AnotherTestClass {
    ILog log = new ILog();

    public void test() {

      log.d();
      log.d("here i'am");
    }
  }
}




Java Source Code List

com.moshx.ilog.ILog.java
com.moshx.ilog.Settings.java
com.moshx.ilog.console.AndroidConsole.java
com.moshx.ilog.console.ConsoleFactory.java
com.moshx.ilog.console.ILogConsole.java
com.moshx.ilog.console.JVMConsole.java
com.moshx.ilog.filelogger.FileLogger.java
com.moshx.ilog.filelogger.HtmlFileLogger.java
com.moshx.ilog.filelogger.TextFileLogger.java
com.moshx.ilog.utils.Utility.java
com.moshx.ilogsample.MainActivity.java
com.moshx.jvmsample.LoggingTest.java