|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSLog.Logger
NSLog.Logger is an abstract class that specifies the core functionality for NSLog.
You can subclass NSLog.Logger to add custom logging implementations based
on email, java.io.PrintWriter
s, display to a Swing window, etc. To add
custom logging implementations based on java.io.PrintStream
, subclass
NSLog.PrintStreamLogger. If you subclass NSLog.Logger, you need only
implement two of the appendln
methods: appendln(Object)
,
and appendln()
, since the other appendln
methods invoke appendln(Object)
and appendln()
. You must also implement flush()
if you subclass.
NSLog
,
NSLog.Log4JLogger
,
NSLog.PrintStreamLogger
Field Summary | |
protected int |
debugLevel
|
protected boolean |
isEnabled
|
protected boolean |
isVerbose
|
Constructor Summary | |
NSLog.Logger()
The default constructor for Logger does nothing. |
Method Summary | |
int |
allowedDebugLevel()
Indicates the debug level for this NSLog.Logger instance. |
abstract void |
appendln()
Since this is an abstract method, it does nothing by default. |
void |
appendln(boolean aValue)
Calls appendln(Object) , passing Boolean.TRUE if aValue is true , or
Boolean.FALSE if aValue is false . |
void |
appendln(byte aValue)
Transforms aValue into a java.lang.Byte object, and passes it to appendln(Object) . |
void |
appendln(byte[] aValue)
Transforms aValue into a java.lang.String object using the default encoding, and passes it to appendln(Object) . |
void |
appendln(char aValue)
Transforms aValue into a java.lang.String object, and passes it to appendln(Object) . |
void |
appendln(char[] aValue)
Transforms aValue into a java.lang.String object, and passes it to appendln(Object) . |
void |
appendln(double aValue)
Transforms aValue into a java.lang.Double object, and passes it to appendln(Object) . |
void |
appendln(float aValue)
Transforms aValue into a java.lang.Float object, and passes it to appendln(Object) . |
void |
appendln(int aValue)
Transforms aValue into a java.lang.Integer object, and passes it to appendln(Object) . |
void |
appendln(long aValue)
Transforms aValue into a java.lang.Long object, and passes it to appendln(Object) . |
abstract void |
appendln(Object aValue)
Since this is an abstract method, it does nothing by default. |
void |
appendln(short aValue)
Transforms aValue into a java.lang.Short object, and passes it to appendln(Object) . |
void |
appendln(Throwable aValue)
Calls appendln(Object) with NSLog.throwableAsString(aValue) as an argument. |
abstract void |
flush()
Since this is an abstract method, it does nothing by default. |
boolean |
isEnabled()
Provides the state of an internal boolean that regulates whether logging is enabled or disabled. |
boolean |
isVerbose()
Provides the state of an internal boolean that regulates whether verbose logging is activated or deactivated. |
void |
setAllowedDebugLevel(int aDebugLevel)
Sets the debug level to aDebugLevel . |
void |
setIsEnabled(boolean aBool)
Sets the value of an internal boolean to aBool . |
void |
setIsVerbose(boolean aBool)
Sets the value of an internal boolean to aBool . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int debugLevel
protected boolean isEnabled
protected boolean isVerbose
Constructor Detail |
public NSLog.Logger()
allowedDebugLevel
is DebugLevelOff
, and both isEnabled
and isVerbose
return true
.
Method Detail |
public int allowedDebugLevel()
NSLog.debug
.
NOTE: Before invoking any of the appendln
methods on NSLog.debug
, check one of the NSLog.debugLoggingAllowedFor...
methods.
The aforementioned NSLog class methods invoke NSLog.debug.allowedDebugLevel
.
Otherwise, the debug level would be useless.
This usage pattern is the only one provided, because methods that encapsulate the check whether to log actually slow execution by an order of magnitude when
logging is disabled.
setAllowedDebugLevel(int)
,
NSLog.debugLoggingAllowedForGroups(long)
,
NSLog.debugLoggingAllowedForLevel(int)
,
NSLog.debugLoggingAllowedForLevelAndGroups(int, long)
public void appendln(boolean aValue)
appendln(Object)
, passing Boolean.TRUE
if aValue
is true
, or
Boolean.FALSE
if aValue
is false
.
aValue
- boolean value to append to outputappendln(Object)
public void appendln(byte aValue)
aValue
into a java.lang.Byte
object, and passes it to appendln(Object)
.
aValue
- byte value to append to outputappendln(Object)
public void appendln(byte[] aValue)
aValue
into a java.lang.String
object using the default encoding, and passes it to appendln(Object)
.
aValue
- byte array to append to outputappendln(Object)
public void appendln(char aValue)
aValue
into a java.lang.String
object, and passes it to appendln(Object)
.
aValue
- char value to append to outputappendln(Object)
public void appendln(char[] aValue)
aValue
into a java.lang.String
object, and passes it to appendln(Object)
.
aValue
- char array to append to outputappendln(Object)
public void appendln(double aValue)
aValue
into a java.lang.Double
object, and passes it to appendln(Object)
.
aValue
- double value to append to outputappendln(Object)
public void appendln(float aValue)
aValue
into a java.lang.Float
object, and passes it to appendln(Object)
.
aValue
- float value to append to outputappendln(Object)
public void appendln(int aValue)
aValue
into a java.lang.Integer
object, and passes it to appendln(Object)
.
aValue
- int value to append to outputappendln(Object)
public void appendln(long aValue)
aValue
into a java.lang.Long
object, and passes it to appendln(Object)
.
aValue
- long value to append to outputappendln(Object)
public void appendln(short aValue)
aValue
into a java.lang.Short
object, and passes it to appendln(Object)
.
aValue
- short value to append to outputappendln(Object)
public void appendln(Throwable aValue)
appendln(Object)
with NSLog.throwableAsString(aValue)
as an argument.
aValue
- the Throwable object to append to outputappendln(Object)
public abstract void appendln(Object aValue)
synchronized
or
otherwise be designed to be thread-safe.
aValue
- the object to be appended to the outputNSLog.Log4JLogger.appendln(Object)
,
NSLog.PrintStreamLogger.appendln(Object)
public abstract void appendln()
NSLog.Log4JLogger.appendln()
,
NSLog.PrintStreamLogger.appendln()
public abstract void flush()
NSLog.Log4JLogger.flush()
,
NSLog.PrintStreamLogger.flush()
public boolean isEnabled()
appendln
.
By default, logging is enabled.
Note that it is up to subclass implementations to pay attention to this setting, as NSLog.Logger does nothing but maintain state in an instance variable.
Typically this instance variable is accessed directly, rather than through this method.
true
setIsEnabled(boolean)
public boolean isVerbose()
Note that it is up to subclass implementations to pay attention to this setting, as NSLog.Logger does nothing but maintain state in an instance variable. Typically this instance variable is accessed directly, rather than through this method.
By default, verbose logging is enabled, except for the default NSLog.PrintStreamLogger object provided initially to NSLog.out
.
true
setIsVerbose(boolean)
public void setAllowedDebugLevel(int aDebugLevel)
aDebugLevel
.
Ignore this setting for any NSLog.Logger except the one assigned to NSLog.debug
.
Typically, this method is invoked at the beginning of the application execution, since it affects logging behavior in the entire application.
By default, logging is allowed for all debug groups.
If the debug level is set to be high (for example, DebugLevelDetailed
), the debugging output may be overwhelming.
NOTE: NSLog stores no state regarding debug level.
If you replace NSLog.debug
using setDebug(Logger)
, you must invoke NSLog.debug.setAllowedDebugLevel
.
Otherwise, use setDebug(Logger, int)
.
aDebugLevel
- level of debug required
IllegalArgumentException
- if aDebugLevel
is invalidallowedDebugLevel()
,
NSLog#setDebug(Logger)
,
NSLog#setDebug(Logger, int)
public void setIsEnabled(boolean aBool)
aBool
.
aBool
- true
to activate logging for this NSLog.Logger instance, otherwise false
isEnabled()
public void setIsVerbose(boolean aBool)
aBool
.
aBool
- true
to activate verbose logging for this NSLog.Logger instance, otherwise false
isVerbose()
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |