Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
Remove the 1-arg rootLogger() because the 2-arg varargs version can b…
Browse files Browse the repository at this point in the history
…e 1-arg.
  • Loading branch information
bobmcwhirter committed Nov 10, 2015
1 parent 1e9325d commit c792476
Showing 1 changed file with 46 additions and 42 deletions.
Expand Up @@ -36,13 +36,18 @@
public class LoggingFraction extends Logging<LoggingFraction> implements Fraction {

public static final String CONSOLE = "CONSOLE";

public static final String PATTERN = "PATTERN";

public static final String COLOR_PATTERN = "COLOR_PATTERN";

public final class Level {
public static final String TRACE = "TRACE";

public static final String DEBUG = "DEBUG";

public static final String ERROR = "ERROR";

public static final String INFO = "INFO";
}

Expand Down Expand Up @@ -118,7 +123,7 @@ public LoggingFraction defaultColorFormatter() {
/**
* Add a new PatternFormatter to this Logger
*
* @param name the name of the formatter
* @param name the name of the formatter
* @param pattern the pattern string
* @return This fraction.
*/
Expand All @@ -130,8 +135,8 @@ public LoggingFraction formatter(String name, String pattern) {
/**
* Add a CustomFormatter to this logger
*
* @param name the name of the formatter
* @param module the module that the logging handler depends on
* @param name the name of the formatter
* @param module the module that the logging handler depends on
* @param className the logging handler class to be used
* @return This fraction.
*/
Expand All @@ -142,9 +147,9 @@ public LoggingFraction customFormatter(String name, String module, String classN
/**
* Add a CustomFormatter to this logger
*
* @param name the name of the formatter
* @param module the module that the logging handler depends on
* @param className the logging handler class to be used
* @param name the name of the formatter
* @param module the module that the logging handler depends on
* @param className the logging handler class to be used
* @param properties the properties
* @return this fraction
*/
Expand All @@ -155,15 +160,16 @@ public LoggingFraction customFormatter(String name, String module, String classN
final String nextElement = (String) names.nextElement();
formatterProperties.put(nextElement, properties.getProperty(nextElement));
}
customFormatter( new CustomFormatter(name)
.module(module)
.attributeClass(className)
.properties(formatterProperties) );
customFormatter(new CustomFormatter(name)
.module(module)
.attributeClass(className)
.properties(formatterProperties));
return this;
}

/**
* Get the list of PatternFormatter configurations
*
* @return The list of formatters
*/
public List<PatternFormatter> patternFormatters() {
Expand All @@ -172,6 +178,7 @@ public List<PatternFormatter> patternFormatters() {

/**
* Get the list of CustomFormatter configurations
*
* @return The list of custom formatters
*/
public List<CustomFormatter> customFormatters() {
Expand All @@ -183,19 +190,20 @@ public List<CustomFormatter> customFormatters() {
/**
* Add a ConsoleHandler to the list of handlers for this logger.
*
* @param level The logging level
* @param level The logging level
* @param formatter A pattern string for the console's formatter
* @return This fraction
*/
public LoggingFraction consoleHandler(String level, String formatter) {
consoleHandler( new ConsoleHandler(CONSOLE)
.level(level)
.namedFormatter(formatter) );
consoleHandler(new ConsoleHandler(CONSOLE)
.level(level)
.namedFormatter(formatter));
return this;
}

/**
* Get the list of ConsoleHandlers for this logger
*
* @return the list of handlers
*/
public List<ConsoleHandler> consoleHandlers() {
Expand All @@ -205,25 +213,26 @@ public List<ConsoleHandler> consoleHandlers() {
/**
* Add a FileHandler to the list of handlers for this logger
*
* @param name The name of the handler
* @param path The log file path
* @param level The logging level
* @param name The name of the handler
* @param path The log file path
* @param level The logging level
* @param formatter The pattern string for the formatter
* @return This fraction
*/
public LoggingFraction fileHandler(String name, String path, String level, String formatter) {
Map fileProperties = new HashMap<>();
fileProperties.put("path", path);
fileProperties.put("relative-to", "jboss.server.log.dir");
fileHandler( new FileHandler(name)
.level(level)
.formatter(formatter)
.file(fileProperties) );
fileHandler(new FileHandler(name)
.level(level)
.formatter(formatter)
.file(fileProperties));
return this;
}

/**
* Get the list of FileHandlers configured on this logger
*
* @return the list of FileHandlers
*/
public List<FileHandler> fileHandlers() {
Expand All @@ -233,11 +242,11 @@ public List<FileHandler> fileHandlers() {
/**
* Add a CustomHandler to this logger
*
* @param name the name of the handler
* @param module the module that the handler uses
* @param className the handler class name
* @param name the name of the handler
* @param module the module that the handler uses
* @param className the handler class name
* @param properties properties for the handler
* @param formatter a pattern string for the formatter
* @param formatter a pattern string for the formatter
* @return this fraction
*/
public LoggingFraction customHandler(String name, String module, String className, Properties properties, String formatter) {
Expand All @@ -248,16 +257,17 @@ public LoggingFraction customHandler(String name, String module, String classNam
handlerProperties.put(nextElement, properties.getProperty(nextElement));
}

customHandler( new CustomHandler(name)
.module(module)
.attributeClass(className)
.formatter(formatter)
.properties(handlerProperties) );
customHandler(new CustomHandler(name)
.module(module)
.attributeClass(className)
.formatter(formatter)
.properties(handlerProperties));
return this;
}

/**
* Get the list of CustomHandlers for this logger
*
* @return the list of handlers
*/
public List<CustomHandler> customHandlers() {
Expand All @@ -266,6 +276,7 @@ public List<CustomHandler> customHandlers() {

/**
* Get the list of AsyncHandlers for this logger
*
* @return the list of handlers
*/
public List<AsyncHandler> asyncHandlers() {
Expand All @@ -274,6 +285,7 @@ public List<AsyncHandler> asyncHandlers() {

/**
* Get the list of SyslogHandlers for this logger
*
* @return the list of handlers
*/
public List<SyslogHandler> syslogHandlers() {
Expand All @@ -286,22 +298,14 @@ public List<SyslogHandler> syslogHandlers() {

/**
* Add a root logger to this fraction
* @param level the log level
* @return this fraction
*/
public LoggingFraction rootLogger(String level) {
return rootLogger(level, null);
}

/**
* Add a root logger to this fraction
* @param level the log level
*
* @param level the log level
* @param handlers a list of handlers
* @return this fraction
*/
public LoggingFraction rootLogger(String level, String... handlers) {
rootLogger( new RootLogger().level(level)
.handlers(new ArrayList<>(Arrays.asList(handlers))) );
rootLogger(new RootLogger().level(level)
.handlers(handlers));
return this;
}

Expand Down

0 comments on commit c792476

Please sign in to comment.