blob: be5736e5a7f52743a9a5125db54c4ca15998b725 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package org.uic.barcode.logger;
import java.util.HashMap;
/**
* A factory for creating Logger objects. This allows to replace the default logger by your own loggers.
*/
public class LoggerFactory {
/** The registered loggers. */
private static HashMap<String,Logger> registeredLoggers = new HashMap<String,Logger>();
/** The activate console log. */
public static boolean activateConsoleLog = false;
/**
* Gets the logger.
*
* @param name the name of the logger. UperEncoder uses asnLogger
* @return the logger
*/
public static Logger getLogger(String name) {
Logger logger = registeredLoggers.get(name);
if (logger == null) {
logger = new Logger(activateConsoleLog);
registeredLoggers.put(name, logger);
}
return logger;
}
/**
* Checks if console log is on.
*
* @return true, if console log is on
*/
public static boolean isActivateConsoleLog() {
return activateConsoleLog;
}
/**
* Sets the console log on
*
* @param activateConsoleLog the new activate console log
*/
public static void setActivateConsoleLog(boolean activateConsoleLog) {
LoggerFactory.activateConsoleLog = activateConsoleLog;
}
/**
* Register logger.
*
* @param name the name of the logger
* @param logger the logger to be registered
*/
public void registerLogger(String name, Logger logger) {
registeredLoggers.put(name, logger);
}
}
|