1 | package org.etsi.common.logging; |
---|
2 | |
---|
3 | import org.etsi.common.logging.LoggingInterface.LogLevel; |
---|
4 | import org.etsi.common.logging.LoggingInterface.MessageClass; |
---|
5 | |
---|
6 | public class LogMessage { |
---|
7 | private String prefix; |
---|
8 | private String filename; |
---|
9 | private int startLine; |
---|
10 | private int endLine; |
---|
11 | private LogLevel logLevel; |
---|
12 | private MessageClass messageClass; |
---|
13 | private String message; |
---|
14 | private String details; |
---|
15 | |
---|
16 | public LogMessage(){ |
---|
17 | |
---|
18 | } |
---|
19 | |
---|
20 | public LogMessage(String filename, int startLine, int endLine, LogLevel logLevel, MessageClass messageClass, String message, String details){ |
---|
21 | this.setFilename(filename); |
---|
22 | this.setStartLine(startLine); |
---|
23 | this.setEndLine(endLine); |
---|
24 | this.setLogLevel(logLevel); |
---|
25 | this.setMessageClass(messageClass); |
---|
26 | this.setMessage(message); |
---|
27 | this.setDetails(details); |
---|
28 | } |
---|
29 | |
---|
30 | public String toString(){ |
---|
31 | String output = ""; |
---|
32 | output += getPrefix(); |
---|
33 | if (getFilename() != null) { |
---|
34 | output += getFilename() + ": "; |
---|
35 | } |
---|
36 | |
---|
37 | if (getStartLine() >= getEndLine()) { |
---|
38 | output += getStartLine() + ": "; |
---|
39 | } else { |
---|
40 | output += getStartLine() + "-" + getEndLine() + ": "; |
---|
41 | } |
---|
42 | |
---|
43 | output += getLogLevel() + ": "; |
---|
44 | |
---|
45 | if (getMessageClass() != null) { |
---|
46 | output += getMessageClass().getDescription() + ": "; |
---|
47 | } |
---|
48 | |
---|
49 | output += getMessage(); |
---|
50 | |
---|
51 | if (getDetails() != null) { |
---|
52 | output += " (" + getDetails() + ")"; |
---|
53 | } |
---|
54 | |
---|
55 | return output; |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | public int getStartLine() { |
---|
60 | return startLine; |
---|
61 | } |
---|
62 | public void setStartLine(int startLine) { |
---|
63 | this.startLine = startLine; |
---|
64 | } |
---|
65 | public int getEndLine() { |
---|
66 | return endLine; |
---|
67 | } |
---|
68 | public void setEndLine(int endLine) { |
---|
69 | this.endLine = endLine; |
---|
70 | } |
---|
71 | public LogLevel getLogLevel() { |
---|
72 | return logLevel; |
---|
73 | } |
---|
74 | public void setLogLevel(LogLevel logLevel) { |
---|
75 | this.logLevel = logLevel; |
---|
76 | } |
---|
77 | public MessageClass getMessageClass() { |
---|
78 | return messageClass; |
---|
79 | } |
---|
80 | public void setMessageClass(MessageClass messageClass) { |
---|
81 | this.messageClass = messageClass; |
---|
82 | } |
---|
83 | public String getMessage() { |
---|
84 | return message; |
---|
85 | } |
---|
86 | public void setMessage(String message) { |
---|
87 | this.message = message; |
---|
88 | } |
---|
89 | public String getDetails() { |
---|
90 | return details; |
---|
91 | } |
---|
92 | public void setDetails(String details) { |
---|
93 | this.details = details; |
---|
94 | } |
---|
95 | |
---|
96 | |
---|
97 | public void setFilename(String filename) { |
---|
98 | this.filename = filename; |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | public String getFilename() { |
---|
103 | return filename; |
---|
104 | } |
---|
105 | |
---|
106 | public void setPrefix(String prefix) { |
---|
107 | this.prefix = prefix; |
---|
108 | } |
---|
109 | |
---|
110 | public String getPrefix() { |
---|
111 | return prefix; |
---|
112 | } |
---|
113 | |
---|
114 | } |
---|