Android Open Source - AndroidAppLog Repository






From Project

Back to project page AndroidAppLog.

License

The source code is released under:

Apache License

If you think the Android project AndroidAppLog 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 me.allenz.androidapplog;
/* ww w . jav a2s  .  c o  m*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Repository {

  private LoggerConfig rootLoggerConfig;

  private Map<String, LoggerConfig> loggerConfigs;

  private Map<String, Logger> loggers;

  private List<Appender> appenders;

  public Repository() {
    loggerConfigs = new HashMap<String, LoggerConfig>();
    loggers = new HashMap<String, Logger>();
    appenders = new ArrayList<Appender>();
  }

  public Repository(final Configure configure) {
    this();
    setConfigure(configure);
  }

  public void setConfigure(final Configure configure) {
    clear();
    configure.applyConfigure(this);
    startAppenders();
  }

  private void clear() {
    LoggerFactory.disableLoggingUncaughtException();
    rootLoggerConfig = null;
    loggerConfigs.clear();
    loggers.clear();
    for (final Appender appender : appenders) {
      appender.stop();
    }
    appenders.clear();
  }

  private void startAppenders() {
    for (final Appender appender : appenders) {
      appender.start();
    }
  }

  public LoggerConfig getRootLoggerConfig() {
    return rootLoggerConfig;
  }

  public void setRootLoggerConfig(final LoggerConfig loggerConfig) {
    this.rootLoggerConfig = loggerConfig;
  }

  public LoggerConfig getLoggerConfig(final String name) {
    return loggerConfigs.get(name);
  }

  public void addLoggerConfig(final LoggerConfig loggerConfig) {
    loggerConfigs.put(loggerConfig.getName(), loggerConfig);
  }

  public Logger getLogger(final String name) {
    return loggers.get(name);
  }

  public void addLogger(final String name, final Logger logger) {
    loggers.put(name, logger);
  }

  public List<Appender> getAppenders() {
    return appenders;
  }

  public void addAppender(final Appender appender) {
    appenders.add(appender);
  }

}




Java Source Code List

me.allenz.androidapplog.AbstractAppender.java
me.allenz.androidapplog.AbstractLogger.java
me.allenz.androidapplog.AppenderSupportLogger.java
me.allenz.androidapplog.Appender.java
me.allenz.androidapplog.AsyncAppender.java
me.allenz.androidapplog.Configure.java
me.allenz.androidapplog.InternalLogger.java
me.allenz.androidapplog.LogCatAppender.java
me.allenz.androidapplog.LogEvent.java
me.allenz.androidapplog.LogLevel.java
me.allenz.androidapplog.LogTextView.java
me.allenz.androidapplog.LoggerConfig.java
me.allenz.androidapplog.LoggerFactory.java
me.allenz.androidapplog.Logger.java
me.allenz.androidapplog.PropertiesParser.java
me.allenz.androidapplog.ReflectUtils.java
me.allenz.androidapplog.Repository.java
me.allenz.androidapplog.RollingFileAppender.java
me.allenz.androidapplog.TextViewAppender.java
me.allenz.androidapplog.UncaughtExceptionLogger.java