diff --git a/src/perl.c b/src/perl.c
index 0c5e8829556c17b70a1e62ca4604ba454f4de7cd..294f69a29018207dd28c2f8b32b5026bd52c73a0 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
static XS (Collectd_plugin_register);
static XS (Collectd_plugin_unregister);
static XS (Collectd_plugin_dispatch_values);
+static XS (Collectd_plugin_log);
/*
{ "Collectd::plugin_register", Collectd_plugin_register },
{ "Collectd::plugin_unregister", Collectd_plugin_unregister },
{ "Collectd::plugin_dispatch_values", Collectd_plugin_dispatch_values },
+ { "Collectd::plugin_log", Collectd_plugin_log },
{ "", NULL }
};
dXSARGS;
- items = 2;
if (2 != items) {
log_err ("Usage: Collectd::plugin_dispatch_values(name, values)");
XSRETURN_EMPTY;
XSRETURN_EMPTY;
} /* static XS (Collectd_plugin_dispatch_values) */
+/*
+ * Collectd::plugin_log (level, message).
+ *
+ * level:
+ * log level (LOG_DEBUG, ... LOG_ERR)
+ *
+ * message:
+ * log message
+ */
+static XS (Collectd_plugin_log)
+{
+ dXSARGS;
+
+ if (2 != items) {
+ log_err ("Usage: Collectd::plugin_log(level, message)");
+ XSRETURN_EMPTY;
+ }
+
+ log_debug ("Collectd::plugin_log: level = %i, message = \"%s\"",
+ SvIV (ST (0)), SvPV_nolen (ST (1)));
+ plugin_log (SvIV (ST (0)), SvPV_nolen (ST (1)));
+ XSRETURN_YES;
+} /* static XS (Collectd_plugin_log) */
+
/*
* Collectd::bootstrap ().
*/