aboutsummaryrefslogtreecommitdiffstats
path: root/perl
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-12 14:40:51 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-02-12 14:40:51 +0300
commit6c8fc71eafb0f0bb069dba703c805a5247c917c7 (patch)
treeefca07d7ff100a183b56eb1bb5d31602444408b3 /perl
parent54480f21f115b40e76806210a61bdde00d3842f7 (diff)
downloadrspamd-6c8fc71eafb0f0bb069dba703c805a5247c917c7.tar.gz
rspamd-6c8fc71eafb0f0bb069dba703c805a5247c917c7.zip
* Add log function to perl API
* Prepare for more detailed work on rspamd perl API
Diffstat (limited to 'perl')
-rw-r--r--perl/rspamd.pm24
-rw-r--r--perl/rspamd.xs18
2 files changed, 41 insertions, 1 deletions
diff --git a/perl/rspamd.pm b/perl/rspamd.pm
index d3b2fac0e..6048f1a3f 100644
--- a/perl/rspamd.pm
+++ b/perl/rspamd.pm
@@ -7,11 +7,35 @@ use warnings;
require Exporter;
our @ISA = qw(Exporter);
+our @EXPORT = qw(
+ module_init
+ module_reload
+ LOG_ERROR
+ LOG_WARNING
+ LOG_MESSAGE
+ LOG_INFO
+ LOG_DEBUG
+);
our $VERSION = '0.0.1';
require XSLoader;
XSLoader::load('rspamd', $VERSION);
+
+sub module_init {
+ my ($cfg) = @_;
+}
+
+sub module_reload {
+ my ($cfg) = @_;
+}
+
+use constant LOG_ERROR => 1 << 3;
+use constant LOG_WARNING => 1 << 4;
+use constant LOG_MESSAGE => 1 << 5;
+use constant LOG_INFO => 1 << 6;
+use constant LOG_DEBUG => 1 << 7;
+
1;
__END__
diff --git a/perl/rspamd.xs b/perl/rspamd.xs
index 4dfc9e665..c7e1ae776 100644
--- a/perl/rspamd.xs
+++ b/perl/rspamd.xs
@@ -464,7 +464,7 @@ OUTPUT:
RETVAL
void
-rspamd_task_get_module_param (r, modulename, paramname)
+rspamd_config_get_module_param (r, modulename, paramname)
CODE:
struct config_file *r;
char *module, *param, *value;
@@ -483,3 +483,19 @@ rspamd_task_get_module_param (r, modulename, paramname)
sv_setpv(TARG, value);
ST(0) = TARG;
+
+MODULE = rspamd PACKAGE = rspamd_log PREFIX = rspamd_log_
+PROTOTYPES: DISABLE
+
+void
+rspamd_log_log (level, str)
+ CODE:
+ int level;
+ char *str;
+
+ level = (int)SvIV (ST(0));
+ str = (char *)SvPV_nolen (ST(1));
+
+ g_log (G_LOG_DOMAIN, level, "%s", str);
+ XSRETURN_EMPTY;
+