3d9bbcfa53426089d556592d911136edabea6290
[sdc.git] /
1 /*
2  * Copyright © 2016-2017 European Support Limited
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 org.openecomp.sdc.logging.slf4j;
18
19 import org.onap.logging.ref.slf4j.ONAPLogConstants;
20 import org.slf4j.Marker;
21 import org.slf4j.MarkerFactory;
22
23 /**
24  * <p>The list of markers that can be used for special logging such as metrics, audit, etc.</p>
25  *
26  * <p>Although markers can be easily instantiated whenever needed, having constants for them helps eliminate mistakes -
27  * misspelling, using a marker that is not handled, etc.</p>
28  *
29  * <p>Usage:</p>
30  *
31  * <pre>
32  *
33  *     Logger log = LogFactory.getLogger(this.getClass());
34  *     log.info(Markers.AUDIT, "User '{}' logged out", user);
35  *
36  * </pre>
37  *
38  * @author EVITALIY
39  * @since 13/09/2016.
40  *
41  * @see Marker
42  */
43 public class Markers {
44
45     public static final Marker ENTRY = MarkerFactory.getMarker(ONAPLogConstants.Markers.ENTRY.getName());
46     public static final Marker EXIT = MarkerFactory.getMarker(ONAPLogConstants.Markers.EXIT.getName());
47
48     public static final Marker METRICS = MarkerFactory.getMarker("METRICS");
49
50     private Markers() {
51         // prevent instantiation
52     }
53 }