package ethanjones.cubes.core.logging.loggers;

import ethanjones.cubes.core.logging.LogLevel;
import ethanjones.cubes.core.logging.LogWriter;

import com.badlogic.gdx.Application;
import com.badlogic.gdx.Gdx;

public class GdxAppLogWriter implements LogWriter {

  @Override
  public void log(LogLevel level, String message) {
    Gdx.app.setLogLevel(getLevel(level));
    Gdx.app.log(Thread.currentThread().getName(), message);
  }

  @Override
  public void log(LogLevel level, String message, Throwable throwable) {
    Gdx.app.setLogLevel(getLevel(level));
    Gdx.app.log(Thread.currentThread().getName(), message, throwable);
  }

  @Override
  public void log(LogLevel level, Throwable throwable) {
    log(level, "", throwable);
  }

  public int getLevel(LogLevel level) {
    switch (level) {
      case error:
        return Application.LOG_ERROR;
      case warning:
        return Application.LOG_ERROR;
      case info:
        return Application.LOG_INFO;
      case debug:
        return Application.LOG_DEBUG;
      default:
        return Application.LOG_NONE;
    }
  }

  @Override
  public void dispose() {

  }
}

@@ -257,16 +257,98 @@
 iter %7B%0A%0A
+  public GdxAppLogWriter() %7B%0A    Gdx.app.setLogLevel(Application.LOG_DEBUG);%0A  %7D%0A%0A
   @Overr
@@ -407,50 +407,8 @@
 ) %7B%0A
-    Gdx.app.setLogLevel(getLevel(level));%0A
     
@@ -557,50 +557,8 @@
 ) %7B%0A
-    Gdx.app.setLogLevel(getLevel(level));%0A
     
@@ -1069,12 +1069,13 @@
 LOG_
-NONE
+DEBUG
 ;%0A  

Fix GdxAppLogWriter