public class ERXNSPrintWriterLogger extends NSLog.Logger
ERXNSPrintWriterLogger
is an alternative of
NSLog.PrintStreamLogger
but accepts character oriented PrintWriter
instead of
byte oriented PrintStream
so that the character encoding for logging can be
explicitly set.
Usage:
// Create a PrintWriter with Japanese "SJIS" encoding. OutputStreamWriter sjisOutWriter = new OutputStreamWriter(new FileOutputStream("app.log"), "SJIS"); PrintWriter sjisPrintWriter = new PrintWriter(sjisOutWriter, true); // Create a logger then set it to NSLog. NSLog.Logger logger = new ERXNSPrintWriterLogger(sjisPrintWriter); NSLog.setDebug(logger); NSLog.setOut(logger); NSLog.setErr(logger);
debugLevel, isEnabled, isVerbose
Constructor and Description |
---|
ERXNSPrintWriterLogger() |
ERXNSPrintWriterLogger(PrintStream printStream) |
ERXNSPrintWriterLogger(PrintWriter printWriter) |
ERXNSPrintWriterLogger(String encodingName) |
Modifier and Type | Method and Description |
---|---|
void |
appendln() |
void |
appendln(Object object) |
void |
flush() |
allowedDebugLevel, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, appendln, isEnabled, isVerbose, setAllowedDebugLevel, setIsEnabled, setIsVerbose
public ERXNSPrintWriterLogger()
public ERXNSPrintWriterLogger(PrintWriter printWriter)
public ERXNSPrintWriterLogger(PrintStream printStream)
public ERXNSPrintWriterLogger(String encodingName) throws UnsupportedEncodingException
UnsupportedEncodingException
public void appendln()
appendln
in class NSLog.Logger
public void appendln(Object object)
appendln
in class NSLog.Logger
public void flush()
flush
in class NSLog.Logger
Copyright © 2002 – 2024 Project Wonder.