Android Open Source - android-filelogger F Logger Wrap Tagged






From Project

Back to project page android-filelogger.

License

The source code is released under:

Apache License

If you think the Android project android-filelogger 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.levelup.logutils;
/*from  w  w  w  .  j  a v  a2  s  .  co  m*/
/**
 * A logger with a hard coded tag that send logs to the supplied FLogger 
 */
public class FLoggerWrapTagged {
  protected final String tag;
  protected final FLogger logger;

  /**
   * method called for every log call in case the file logger wasn't ready before
   * 
   * @param level
   */
  protected void assertLogger(FLogLevel level) {}
  
  public FLoggerWrapTagged(FLogger logger, String tag) {
    assertLogger(FLogLevel.V);
    this.tag = tag;
    this.logger = logger;
  }

  public int v(String message) {
    assertLogger(FLogLevel.V);
    logger.v(tag, message);
    return 0;
  }

  public int v(String message, Throwable tr) {
    assertLogger(FLogLevel.V);
    logger.v(tag, message, tr);
    return 0;
  }

  public int d(String message) {
    assertLogger(FLogLevel.D);
    logger.d(tag, message);
    return 0;
  }

  public int d(String message, Throwable tr) {
    assertLogger(FLogLevel.D);
    logger.d(tag, message, tr);
    return 0;
  }

  public int i(String message) {
    assertLogger(FLogLevel.I);
    logger.i(tag, message);
    return 0;
  }

  public int i(String message, Throwable tr) {
    assertLogger(FLogLevel.I);
    logger.i(tag, message, tr);
    return 0;
  }

  public int w(String message) {
    assertLogger(FLogLevel.W);
    logger.w(tag, message);
    return 0;
  }

  public int w(String message, Throwable tr) {
    assertLogger(FLogLevel.W);
    logger.w(tag, message, tr);
    return 0;
  }

  public int e(String message) {
    assertLogger(FLogLevel.E);
    logger.e(tag, message);
    return 0;
  }

  public int e(String message, Throwable tr) {
    assertLogger(FLogLevel.E);
    logger.e(tag, message, tr);
    return 0;
  }

  public int wtf(String message) {
    assertLogger(FLogLevel.WTF);
    logger.wtf(tag, message);
    return 0;
  }

  public int wtf(String message, Throwable tr) {
    assertLogger(FLogLevel.WTF);
    logger.wtf(tag, message, tr);
    return 0;
  }

}




Java Source Code List

com.levelup.logutils.FLogLevel.java
com.levelup.logutils.FLog.java
com.levelup.logutils.FLoggerTagged.java
com.levelup.logutils.FLoggerWrapTagged.java
com.levelup.logutils.FLogger.java
com.levelup.logutils.FileLogger.java
com.levelup.logutils.LogCollecting.java
com.levelup.logutils.LogCollectorEmail.java
com.levelup.logutils.sample.MainActivity.java