/**
 * Copyright 2012 The PlayN Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package playn.ios;

import java.io.PrintWriter;
import java.io.StringWriter;

import cli.System.Console;

import playn.core.LogImpl;

public class IOSLog extends LogImpl {

  @Override
  protected void logImpl(Level level, String msg, Throwable e) {
    Console.WriteLine(level + ": " + msg);

    if (e != null) {
      StringWriter sw = new StringWriter();
      e.printStackTrace(new PrintWriter(sw));
      Console.WriteLine(sw.toString());
    }
  }
}

@@ -902,24 +902,38 @@
  != null) %7B%0A
+      try %7B%0A  
       String
@@ -970,16 +970,18 @@
 ;%0A      
+ 
+ 
 e.printS
@@ -1014,24 +1014,26 @@
 sw));%0A      
+  
 Console.Writ
@@ -1050,24 +1050,165 @@
 oString());%0A
+      %7D catch (Throwable t) %7B%0A        Console.WriteLine(e);%0A        Console.WriteLine(%22%3Cstack trace generation failed: %22 + t + %22%3E%22);%0A      %7D%0A
     %7D%0A  %7D%0A%7D%0A

Harden against crash when generating stack trace.