java plugin: Expose `plugin_log' to Java plugins.
[collectd.git] / bindings / java / org / collectd / api / CollectdAPI.java
index 9dbe7c0..2b6e06c 100644 (file)
@@ -28,15 +28,11 @@ package org.collectd.api;
  */
 public class CollectdAPI
 {
-  /**
-   * Java representation of collectd/src/plugin.h:plugin_dispatch_values
-   */
-  native public static int DispatchValues (ValueList vl);
-
-  /**
-   * Java representation of collectd/src/plugin.h:plugin_get_ds
-   */
-  native public static DataSet GetDS (String type);
+  private static final int LOG_ERR     = 3;
+  private static final int LOG_WARNING = 4;
+  private static final int LOG_NOTICE  = 5;
+  private static final int LOG_INFO    = 6;
+  private static final int LOG_DEBUG   = 7;
 
   /**
    * Java representation of collectd/src/plugin.h:plugin_register_config
@@ -67,6 +63,47 @@ public class CollectdAPI
    */
   native public static int RegisterShutdown (String name,
       CollectdShutdownInterface obj);
+
+  /**
+   * Java representation of collectd/src/plugin.h:plugin_dispatch_values
+   */
+  native public static int DispatchValues (ValueList vl);
+
+  /**
+   * Java representation of collectd/src/plugin.h:plugin_get_ds
+   */
+  native public static DataSet GetDS (String type);
+
+  /**
+   * Java representation of collectd/src/plugin.h:plugin_log
+   */
+  native private static void Log (int severity, String message);
+
+  public static void LogError (String message)
+  {
+    Log (LOG_ERR, message);
+  } /* void LogError */
+
+  public static void LogWarning (String message)
+  {
+    Log (LOG_WARNING, message);
+  } /* void LogWarning */
+
+  public static void LogNotice (String message)
+  {
+    Log (LOG_NOTICE, message);
+  } /* void LogNotice */
+
+  public static void LogInfo (String message)
+  {
+    Log (LOG_INFO, message);
+  } /* void LogInfo */
+
+  public static void LogDebug (String message)
+  {
+    Log (LOG_DEBUG, message);
+  } /* void LogDebug */
+
 } /* class CollectdAPI */
 
 /* vim: set sw=2 sts=2 et fdm=marker : */