// PrintStreamAppender.java

/**
*    Copyright (C) 2008 10gen Inc.
*  
*    This program is free software: you can redistribute it and/or  modify
*    it under the terms of the GNU Affero General Public License, version 3,
*    as published by the Free Software Foundation.
*  
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Affero General Public License for more details.
*  
*    You should have received a copy of the GNU Affero General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

package ed.log;

import java.io.*;

public class PrintStreamAppender implements Appender {

    public PrintStreamAppender( PrintStream out ){
        _out = out;
    }

    public void append( String loggerName , ed.js.JSDate date , Level level , String msg , Throwable throwable , Thread thread ){
        _out.println( "[" + date + "] " + thread.getName() + " || " + loggerName + " " + level + " >> " + msg );
        if ( throwable != null )
            throwable.printStackTrace( _out );
    }

    final PrintStream _out;

}

@@ -1006,21 +1006,23 @@
     
-_out.println(
+String output =
  %22%5B%22
@@ -1106,18 +1106,187 @@
 %22 + msg 
-);
++ %22%5Cn%22;%0A        try %7B%0A            _out.write( output.getBytes( %22utf8%22 ) );%0A        %7D%0A        catch ( IOException encodingBad )%7B%0A            _out.print( output );%0A        %7D
 %0A       

write out as utf8