Class DefaultLogger
- java.lang.Object
-
- org.xmlresolver.logging.AbstractLogger
-
- org.xmlresolver.logging.DefaultLogger
-
- All Implemented Interfaces:
ResolverLogger
public class DefaultLogger extends AbstractLogger
The default logger logs toSystem.err.By default, the
DEFAULT_LOGGER_LOG_LEVELfeature determines which messages are logged. The valid levels are "debug", "info", "warn", and "none". An invalid level is treated as "warn".If the level is set to "debug", all messages will be printed. If set to "info", info and warning messages will be printed. If set to "warn", only warning messages will be printed. If set to "none", no messages are printed.
If the configuration's
DEFAULT_LOGGER_LOG_LEVELis changed, that change will be detected by the logger and it will use that level going forward. The value can also be changed directly by callingsetLogLevel(java.lang.String). That level will remain in effect as long as the configuration default does not change.
-
-
Constructor Summary
Constructors Constructor Description DefaultLogger(ResolverConfiguration config)Initialize the logger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.lang.String message)Writes a debug message toSystem.err.java.lang.StringgetLogLevel()Get the current logging level.voidinfo(java.lang.String message)Writes an informational message toSystem.err.voidsetLogLevel(java.lang.String level)Set the current logging level.voidwarn(java.lang.String message)Writes a warning message toSystem.err.-
Methods inherited from class org.xmlresolver.logging.AbstractLogger
getCategory, log, setCategory
-
-
-
-
Constructor Detail
-
DefaultLogger
public DefaultLogger(ResolverConfiguration config)
Initialize the logger.The
DEFAULT_LOGGER_LOG_LEVELis obtained from the configuration.- Parameters:
config- The resolver configuration.
-
-
Method Detail
-
getLogLevel
public java.lang.String getLogLevel()
Get the current logging level.- Returns:
- the current logging level
-
setLogLevel
public void setLogLevel(java.lang.String level)
Set the current logging level.- Parameters:
level- The logging level.
-
info
public void info(java.lang.String message)
Writes an informational message toSystem.err.- Parameters:
message- The message.
-
debug
public void debug(java.lang.String message)
Writes a debug message toSystem.err.- Parameters:
message- The message.
-
warn
public void warn(java.lang.String message)
Writes a warning message toSystem.err.- Parameters:
message- The message.
-
-