PATH |
NSLog.PrintStreamLogger
- Inherits from:
- NSLog.Logger
- Package:
- com.webobjects.foundation
Class Description
NSLog.PrintStreamLogger is a concrete subclass of NSLog.Logger. It logs output to a java.io.PrintStream which is contained by the logger. This PrintStream can be changed, which causes the receiver to output log messages somewhere else, such as a local file. Methods are provided to enable and disable logging, and to enable and disable verbose logging.
NSLog.out and NSLog.debug are PrintStreamLoggers that point at System.out. NSLog.err is a PrintStreamLogger that points to System.err.
NSLog.PrintStreamLogger looks at the value of the internal variables set by NSLog.Logger.setIsVerbose() and NSLog.Logger.setIsEnabled() to determine whether to produce verbose output and to determine whether to log messages to the logger. See the method descriptions for these methods in the documentation for "NSLog.Logger" (page 139).
Method Types
- All methods
- NSLog.PrintStreamLogger
- appendln
- appendln
- flush
- printStream
- setPrintStream
Constructors
NSLog.PrintStreamLogger
public NSLog.PrintStreamLogger(java.io.PrintStream aPrintStream)
public NSLog.PrintStreamLogger()
Instance Methods
appendln
public void appendln()
appendln
public void appendln(Throwable aThrowable)
appendln
public void appendln(Object anObject)
flush
public void flush()
printStream
public java.io.PrintStream printStream()
setPrintStream
public void setPrintStream(java.io.PrintStream aPrintStream)
NSLog.PrintStreamLogger aLogger = new NSLog.PrintStreamLogger(); // Output defaults to System.out PrintStream aStream = NSLog.printStreamForPath ("/Local/Users/log.txt"); // New print stream based on path. aLogger.setPrintStream (aStream); // Direct output to the custom PrintStream. NSLog.setOut(aLogger); // Assign the custom PrintStreamLogger to the declared instances of NSLogger in NSLog NSLog.setErr(aLogger); NSLog.setDebug(aLogger); aLogger.appendln(anObject);
© 2001 Apple Computer, Inc. (Last Published April 17, 2001)