Fix mi: add support for Jul loglevel
authorJonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Wed, 25 Jun 2014 17:34:12 +0000 (13:34 -0400)
committerJonathan Rajotte Julien <jonathan.r.julien@gmail.com>
Tue, 22 Jul 2014 20:14:57 +0000 (16:14 -0400)
Signed-off-by: Jonathan Rajotte Julien <jonathan.r.julien@gmail.com>
src/bin/lttng/commands/list.c
src/common/mi-lttng.c
src/common/mi-lttng.h
src/common/mi_lttng.xsd

index 2dd0dc8a331d0a34e09764ce1b3217c9d6e1bcf7..210c2f437708ef6a7e0ec3531762b6c6cd25ad48 100644 (file)
@@ -184,34 +184,6 @@ const char *exclusion_string(int value)
        }
 }
 
-static const char *loglevel_jul_string(int value)
-{
-       switch (value) {
-       case -1:
-               return "";
-       case LTTNG_LOGLEVEL_JUL_OFF:
-               return "JUL_OFF";
-       case LTTNG_LOGLEVEL_JUL_SEVERE:
-               return "JUL_SEVERE";
-       case LTTNG_LOGLEVEL_JUL_WARNING:
-               return "JUL_WARNING";
-       case LTTNG_LOGLEVEL_JUL_INFO:
-               return "JUL_INFO";
-       case LTTNG_LOGLEVEL_JUL_CONFIG:
-               return "JUL_CONFIG";
-       case LTTNG_LOGLEVEL_JUL_FINE:
-               return "JUL_FINE";
-       case LTTNG_LOGLEVEL_JUL_FINER:
-               return "JUL_FINER";
-       case LTTNG_LOGLEVEL_JUL_FINEST:
-               return "JUL_FINEST";
-       case LTTNG_LOGLEVEL_JUL_ALL:
-               return "JUL_ALL";
-       default:
-               return "<<UNKNOWN>>";
-       }
-}
-
 static const char *logleveltype_string(enum lttng_loglevel_type value)
 {
        switch (value) {
@@ -913,7 +885,7 @@ static int list_session_jul_events(void)
                        MSG("%s- %s%s (loglevel%s %s)", indent4, events[i].name,
                                        enabled_string(events[i].enabled),
                                        logleveltype_string(events[i].loglevel_type),
-                                       loglevel_jul_string(events[i].loglevel));
+                                       mi_lttng_loglevel_string(events[i].loglevel));
                }
 
                MSG("");
index cd5c082fd316bb867216be8acf40c2e60ee6a387..9c98a0dd7712ce589347e0bbd0a285168a6575e5 100644 (file)
@@ -114,6 +114,17 @@ const char * const mi_lttng_loglevel_str_notice = "TRACE_NOTICE";
 const char * const mi_lttng_loglevel_str_unknown = "UNKNOWN";
 const char * const mi_lttng_loglevel_str_warning = "TRACE_WARNING";
 
+/* String related to loglevel JUL */
+const char * const mi_lttng_loglevel_str_jul_all = "JUL_ALL";
+const char * const mi_lttng_loglevel_str_jul_config = "JUL_CONFIG";
+const char * const mi_lttng_loglevel_str_jul_fine = "JUL_FINE";
+const char * const mi_lttng_loglevel_str_jul_finer = "JUL_FINER";
+const char * const mi_lttng_loglevel_str_jul_finest = "JUL_FINEST";
+const char * const mi_lttng_loglevel_str_jul_info = "JUL_INFO";
+const char * const mi_lttng_loglevel_str_jul_off = "JUL_OFF";
+const char * const mi_lttng_loglevel_str_jul_severe = "JUL_SEVERE";
+const char * const mi_lttng_loglevel_str_jul_warning = "JUL_WARNING";
+
 /* String related to loglevel type */
 const char * const mi_lttng_loglevel_type_all = "ALL";
 const char * const mi_lttng_loglevel_type_range = "RANGE";
@@ -132,6 +143,10 @@ const char * const mi_lttng_element_snapshot_n_ptr = "n_ptr";
 const char * const mi_lttng_element_snapshot_session_name = "session_name";
 const char * const mi_lttng_element_snapshots = "snapshots";
 
+/* This is a merge of jul loglevel and regular loglevel
+ * Those should never overlap by definition
+ * (see struct lttng_event loglevel)
+ */
 const char *mi_lttng_loglevel_string(int value)
 {
        switch (value) {
@@ -167,6 +182,24 @@ const char *mi_lttng_loglevel_string(int value)
                return mi_lttng_loglevel_str_debug_line;
        case LTTNG_LOGLEVEL_DEBUG:
                return mi_lttng_loglevel_str_debug;
+       case LTTNG_LOGLEVEL_JUL_OFF:
+               return mi_lttng_loglevel_str_jul_off;
+       case LTTNG_LOGLEVEL_JUL_SEVERE:
+               return mi_lttng_loglevel_str_jul_severe;
+       case LTTNG_LOGLEVEL_JUL_WARNING:
+               return mi_lttng_loglevel_str_jul_warning;
+       case LTTNG_LOGLEVEL_JUL_INFO:
+               return mi_lttng_loglevel_str_jul_info;
+       case LTTNG_LOGLEVEL_JUL_CONFIG:
+               return mi_lttng_loglevel_str_jul_config;
+       case LTTNG_LOGLEVEL_JUL_FINE:
+               return mi_lttng_loglevel_str_jul_fine;
+       case LTTNG_LOGLEVEL_JUL_FINER:
+               return mi_lttng_loglevel_str_jul_finer;
+       case LTTNG_LOGLEVEL_JUL_FINEST:
+               return mi_lttng_loglevel_str_jul_finest;
+       case LTTNG_LOGLEVEL_JUL_ALL:
+               return mi_lttng_loglevel_str_jul_all;
        default:
                return mi_lttng_loglevel_str_unknown;
        }
index 476310ba404c5655345e1b6e3699ac5b643b2fce..e5ca544737f373bee2a56e8bbd0aef5fc4e489a1 100644 (file)
@@ -138,6 +138,17 @@ const char * const mi_lttng_loglevel_str_notice;
 const char * const mi_lttng_loglevel_str_unknown;
 const char * const mi_lttng_loglevel_str_warning;
 
+/* String related to loglevel JUL */
+const char * const mi_lttng_loglevel_str_jul_all;
+const char * const mi_lttng_loglevel_str_jul_config;
+const char * const mi_lttng_loglevel_str_jul_fine;
+const char * const mi_lttng_loglevel_str_jul_finer;
+const char * const mi_lttng_loglevel_str_jul_finest;
+const char * const mi_lttng_loglevel_str_jul_info;
+const char * const mi_lttng_loglevel_str_jul_off;
+const char * const mi_lttng_loglevel_str_jul_severe;
+const char * const mi_lttng_loglevel_str_jul_warning;
+
 /* String related to loglevel type */
 const char * const mi_lttng_loglevel_type_all;
 const char * const mi_lttng_loglevel_type_range;
@@ -148,7 +159,7 @@ const char * const mi_lttng_loglevel_type_unknown;
 const char * const mi_lttng_element_calibrate;
 const char * const mi_lttng_element_calibrate_function;
 
-/* String related to a lttng_snashot */
+/* String related to a lttng_snapshot */
 const char * const mi_lttng_element_snapshot_ctrl_url;
 const char * const mi_lttng_element_snapshot_data_url;
 const char * const mi_lttng_element_snapshot_max_size;
@@ -324,7 +335,7 @@ int mi_lttng_sessions_open(struct mi_writer *writer);
  * is_open Defines whether or not the session element shall be closed.
  *         This should be used carefully and the client
  *         must close the session element.
- *         Use case: nested addtionnal information on a session
+ *         Use case: nested additional information on a session
  *                  ex: domain,channel event.
  *
  * Returns zero if the element's value could be written.
index 57960119e5571f4820808d8c10f61a897d91b221..c5bd1d935a7b846f6b97a8b786789b9c7cd3cb06 100644 (file)
@@ -123,6 +123,15 @@ THE SOFTWARE.
                        <xs:enumeration value="TRACE_DEBUG_FUNCTION" />
                        <xs:enumeration value="TRACE_DEBUG_LINE" />
                        <xs:enumeration value="TRACE_DEBUG" />
+                       <xs:enumeration value="JUL_OFF" />
+                       <xs:enumeration value="JUL_SEVERE" />
+                       <xs:enumeration value="JUL_WARNING" />
+                       <xs:enumeration value="JUL_INFO" />
+                       <xs:enumeration value="JUL_CONFIG" />
+                       <xs:enumeration value="JUL_FINE" />
+                       <xs:enumeration value="JUL_FINER" />
+                       <xs:enumeration value="JUL_FINEST" />
+                       <xs:enumeration value="JUL_ALL" />
                        <xs:enumeration value="UNKNOWN" />
                </xs:restriction>
        </xs:simpleType>
This page took 0.029023 seconds and 4 git commands to generate.