View Javadoc

1   /*
2    * This file is part of AceLogger.
3    * 
4    * AceLogger is free software: you can redistribute it and/or modify it under the terms of the GNU
5    * Lesser General Public License as published by the Free Software Foundation, either version 3 of
6    * the License, or (at your option) any later version.
7    * 
8    * AceLogger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9    * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10   * Lesser General Public License for more details.
11   * 
12   * You should have received a copy of the GNU Lesser General Public License along with AceLogger.
13   * If not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
14   */
15  package net.sourceforge.acelogger;
16  
17  import net.sourceforge.acelogger.appender.SystemOutAppender;
18  import net.sourceforge.acelogger.execution.manager.SynchronousExecutorManager;
19  import net.sourceforge.acelogger.formatter.SimpleFormatter;
20  import net.sourceforge.acelogger.level.LogLevel;
21  import net.sourceforge.acelogger.level.filter.GreaterOrEqualLevelFilter;
22  import net.sourceforge.acelogger.location.gatherer.FileAndLineLocationGatherer;
23  
24  /**
25   * A pre-configured Logger using A simple formatter, logging to system err and generating file and
26   * line location for calls greater than info. This logger execution is all synchronous.
27   * 
28   * @author Zardi (https://sourceforge.net/users/daniel_zardi)
29   * @version 1.0.0
30   * @since 1.0.0
31   */
32  public class SimpleLogger extends BaseLogger {
33  
34  	/**
35  	 * Constructs a GenericLogger using the supplied identifier.
36  	 * 
37  	 * @param identifier
38  	 *            The identifier of this logger.
39  	 */
40  	public SimpleLogger(String identifier) {
41  		super(identifier,
42  				new SystemOutAppender(identifier,
43  						new SimpleFormatter(identifier),
44  						new SynchronousExecutorManager(identifier)
45  					),
46  				new GreaterOrEqualLevelFilter(identifier, LogLevel.INFO),
47  				new FileAndLineLocationGatherer(identifier)
48  			);
49  	}
50  
51  }