Java Reference
In-Depth Information
boolean disconnect();
boolean log(String msg);
Eachofthe connect() , disconnect() ,and log() methodsreturnstrueupon
success, and false upon failure. (Later in this chapter, you will discover a better tech-
niquefordealingwithfailure.)Thesemethodsarenotdeclared public explicitlybe-
cause an interface's methods are implicitly public .
Listing 3-18 presents the LoggerFactory abstract class.
Listing 3-18. Obtaining a logger for logging messages to a specific destination
package logging;
public abstract class LoggerFactory
public final static int CONSOLE = 0;
public final static int FILE = 1;
public static Logger newLogger(int dstType, String...
switch (dstType)
case CONSOLE: return new Console(dstName.length ==
0 ? null
case FILE
: return new File(dstName.length == 0
? null
: return null;
Search WWH ::

Custom Search