lttng: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.lttng2.control.core / src / org / eclipse / linuxtools / internal / lttng2 / control / core / model / TraceLogLevel.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 * Jonathan Rajotte - Utility function
12 *********************************************************************/
13 package org.eclipse.linuxtools.internal.lttng2.control.core.model;
14
15
16 /**
17 * Log Level enumeration.
18 *
19 * @author Bernd Hufmann
20 */
21 @SuppressWarnings("nls")
22 public enum TraceLogLevel {
23
24 // ------------------------------------------------------------------------
25 // Enum definition
26 // ------------------------------------------------------------------------
27 /** Log level 0 */
28 TRACE_EMERG("TRACE_EMERG"),
29 /** Log level 1 */
30 TRACE_ALERT("TRACE_ALERT"),
31 /** Log level 2 */
32 TRACE_CRIT("TRACE_CRIT"),
33 /** Log level 3 */
34 TRACE_ERR("TRACE_ERR"),
35 /** Log level 4 */
36 TRACE_WARNING("TRACE_WARNING"),
37 /** Log level 5 */
38 TRACE_NOTICE("TRACE_NOTICE"),
39 /** Log level 6 */
40 TRACE_INFO("TRACE_INFO"),
41 /** Log level 7 */
42 TRACE_DEBUG_SYSTEM("TRACE_DEBUG_SYSTEM"),
43 /** Log level 8 */
44 TRACE_DEBUG_PROGRAM("TRACE_DEBUG_PROGRAM"),
45 /** Log level 9 */
46 TRACE_DEBUG_PROCESS("TRACE_DEBUG_PROCESS"),
47 /** Log level 10 */
48 TRACE_DEBUG_MODULE("TRACE_DEBUG_MODULE"),
49 /** Log level 11 */
50 TRACE_DEBUG_UNIT("TRACE_DEBUG_UNIT"),
51 /** Log level 12 */
52 TRACE_DEBUG_FUNCTION("TRACE_DEBUG_FUNCTION"),
53 /** Log level 13 */
54 TRACE_DEBUG_LINE("TRACE_DEBUG_LINE"),
55 /** Log level 14 */
56 TRACE_DEBUG("TRACE_DEBUG"),
57 /** Log level 15 */
58 LEVEL_UNKNOWN("LEVEL_UNKNOWN");
59
60 // ------------------------------------------------------------------------
61 // Attributes
62 // ------------------------------------------------------------------------
63 /**
64 * Name of enum.
65 */
66 private final String fInName;
67
68 // ------------------------------------------------------------------------
69 // Constuctors
70 // ------------------------------------------------------------------------
71
72 /**
73 * Private constructor
74 *
75 * @param name
76 * the name of state
77 */
78 private TraceLogLevel(String name) {
79 fInName = name;
80 }
81
82 // ------------------------------------------------------------------------
83 // Accessors
84 // ------------------------------------------------------------------------
85 /**
86 * @return state name
87 */
88 public String getInName() {
89 return fInName;
90 }
91
92 // ------------------------------------------------------------------------
93 // Utility
94 // ------------------------------------------------------------------------
95 /**
96 * Return the corresponding {@link TraceLogLevel} to String "name"
97 *
98 * @param name
99 * String to compare to retrieve the good {@link TraceLogLevel}
100 * @return the corresponding {@link TraceLogLevel}
101 */
102 public static TraceLogLevel valueOfString(String name) {
103 if (name == null) {
104 throw new IllegalArgumentException();
105 }
106 for (TraceLogLevel tllevel : TraceLogLevel.values()) {
107 if (tllevel.getInName().equalsIgnoreCase(name)) {
108 return tllevel;
109 }
110 }
111 // No match
112 return LEVEL_UNKNOWN;
113 }
114 }
This page took 0.033197 seconds and 5 git commands to generate.