1 package org.codehaus.plexus.logging.console;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.codehaus.plexus.logging.AbstractLogger;
20 import org.codehaus.plexus.logging.Logger;
21
22
23
24
25
26
27
28
29 public final class ConsoleLogger extends AbstractLogger {
30 public ConsoleLogger(int threshold, String name) {
31 super(threshold, name);
32 }
33
34 public void debug(String message, Throwable throwable) {
35 if (isDebugEnabled()) {
36 System.out.print("[DEBUG] ");
37 System.out.println(message);
38
39 if (null != throwable) {
40 throwable.printStackTrace(System.out);
41 }
42 }
43 }
44
45 public void info(String message, Throwable throwable) {
46 if (isInfoEnabled()) {
47 System.out.print("[INFO] ");
48 System.out.println(message);
49
50 if (null != throwable) {
51 throwable.printStackTrace(System.out);
52 }
53 }
54 }
55
56 public void warn(String message, Throwable throwable) {
57 if (isWarnEnabled()) {
58 System.out.print("[WARNING] ");
59 System.out.println(message);
60
61 if (null != throwable) {
62 throwable.printStackTrace(System.out);
63 }
64 }
65 }
66
67 public void error(String message, Throwable throwable) {
68 if (isErrorEnabled()) {
69 System.out.print("[ERROR] ");
70 System.out.println(message);
71
72 if (null != throwable) {
73 throwable.printStackTrace(System.out);
74 }
75 }
76 }
77
78 public void fatalError(String message, Throwable throwable) {
79 if (isFatalErrorEnabled()) {
80 System.out.print("[FATAL ERROR] ");
81 System.out.println(message);
82
83 if (null != throwable) {
84 throwable.printStackTrace(System.out);
85 }
86 }
87 }
88
89 public Logger getChildLogger(String name) {
90 return this;
91 }
92 }