Java Reference
In-Depth Information
newLogger() returns a Logger instance for logging messages to an appropriate
destination.Itusesthevariableumberofargumentsfeature(see Chapter2 ) tooptionally
acceptanextra String argumentforthosedestinationtypesthatrequiretheargument.
For example, FILE requires a filename.
Listing3-19 presentsthepackage-private Console class-thisclassisnotaccessible
beyondtheclassesinthe logging packagebecausereservedword class isnotpre-
ceded by reserved word public .
Listing 3-19. Logging messages to the console
package logging;
class Console implements Logger
{
private String dstName;
Console(String dstName)
{
this.dstName = dstName;
}
@Override
public boolean connect()
{
return true;
}
@Override
public boolean disconnect()
{
return true;
}
@Override
public boolean log(String msg)
{
System.out.println(msg);
return true;
}
}
Search WWH ::




Custom Search