Java SDK and Eclipse plugin for simulator.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / logger / LogEntry.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package oic.simulator.logger;
18
19 import java.util.Date;
20
21 import oic.simulator.clientcontroller.manager.LogManager;
22
23 /**
24  * Class for log entry.
25  */
26 public class LogEntry {
27     private final int    severity;
28     private final Date   date;
29     private final String message;
30
31     public LogEntry(int severity, Date date, String message) {
32         this.severity = severity;
33         this.date = date;
34         this.message = message;
35     }
36
37     public String getMessage() {
38         return message;
39     }
40
41     public Date getDate() {
42         return date;
43     }
44
45     public int getSeverity() {
46         return severity;
47     }
48
49     @Override
50     public String toString() {
51         String newline = System.getProperty("line.separator");
52         String out = date.toString() + newline;
53         out += "Severity: " + LogManager.getSeverityName(severity) + newline;
54         out += "Message: " + message + newline;
55         out += "===============================" + newline + newline;
56         return out;
57     }
58 }