aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-04-16 14:01:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-04-16 14:01:13 +0000
commita23e77e48cb880db18a83bb407cefaf2f3c5d885 (patch)
tree7e85f6d1786906c69f25fa070742e83fd3e142a4 /ruby
parente20da32820ee62e72e2650dae31660657452b270 (diff)
downloadpaludis-a23e77e48cb880db18a83bb407cefaf2f3c5d885.tar.gz
paludis-a23e77e48cb880db18a83bb407cefaf2f3c5d885.tar.xz
Give log messages an id
Diffstat (limited to 'ruby')
-rw-r--r--ruby/log.cc12
-rw-r--r--ruby/log_TEST.rb8
2 files changed, 10 insertions, 10 deletions
diff --git a/ruby/log.cc b/ruby/log.cc
index 97cb012..7c446dd 100644
--- a/ruby/log.cc
+++ b/ruby/log.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006 Ciaran McCreesh
+ * Copyright (c) 2006, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -74,18 +74,18 @@ namespace
/*
* call-seq:
- * message(log_level, message)
+ * message(id, log_level, message)
*
* Log a message at the specified level.
*/
VALUE
- log_message(VALUE self, VALUE log_level, VALUE message)
+ log_message(VALUE self, VALUE id, VALUE log_level, VALUE message)
{
int l = NUM2INT(log_level);
if (l < 0 || l >= last_ll)
rb_raise(rb_eTypeError, "Log.log_message expects a valid LogLevel as the first parameter");
- Log::get_instance()->message(static_cast<LogLevel>(l), lc_no_context,
- stringify(StringValuePtr(message)));
+ Log::get_instance()->message(stringify(StringValuePtr(id)), static_cast<LogLevel>(l), lc_no_context)
+ << stringify(StringValuePtr(message));
return self;
}
@@ -103,7 +103,7 @@ namespace
rb_define_method(c_log, "log_level", RUBY_FUNC_CAST(&log_log_level), 0);
rb_define_method(c_log, "log_level=", RUBY_FUNC_CAST(&log_log_level_set), 1);
rb_define_method(c_log, "program_name=", RUBY_FUNC_CAST(&log_set_program_name), 1);
- rb_define_method(c_log, "message", RUBY_FUNC_CAST(&log_message), 2);
+ rb_define_method(c_log, "message", RUBY_FUNC_CAST(&log_message), 3);
/*
* Document-module: Paludis::LogLevel
diff --git a/ruby/log_TEST.rb b/ruby/log_TEST.rb
index dac154f..e680bed 100644
--- a/ruby/log_TEST.rb
+++ b/ruby/log_TEST.rb
@@ -2,7 +2,7 @@
# vim: set sw=4 sts=4 et tw=80 :
#
-# Copyright (c) 2006 Ciaran McCreesh
+# Copyright (c) 2006, 2008 Ciaran McCreesh
#
# This file is part of the Paludis package manager. Paludis is free software;
# you can redistribute it and/or modify it under the terms of the GNU General
@@ -72,7 +72,7 @@ module Paludis
class TestCase_LogMessage < Test::Unit::TestCase
def test_log_message
- Log.instance.message LogLevel::Warning, "This is a test warning message"
+ Log.instance.message "ruby.test", LogLevel::Warning, "This is a test warning message"
end
def test_log_message_bad
@@ -81,11 +81,11 @@ module Paludis
end
assert_raise TypeError do
- Log.instance.message "Warning", "This should fail"
+ Log.instance.message "ruby.test", "Warning", "This should fail"
end
assert_raise TypeError do
- Log.instance.message 456, "This should fail"
+ Log.instance.message "ruby.test", 456, "This should fail"
end
end
end