Skip to content

Commit 6d7e465

Browse files
committed
Define log level
1 parent 38ed0e3 commit 6d7e465

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

bindings/ruby/ext/ruby_whisper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,13 @@ void Init_whisper() {
15021502
cContext = rb_define_class_under(mWhisper, "Context", rb_cObject);
15031503
cParams = rb_define_class_under(mWhisper, "Params", rb_cObject);
15041504

1505+
rb_define_const(mWhisper, "LOG_LEVEL_NONE", INT2NUM(GGML_LOG_LEVEL_NONE));
1506+
rb_define_const(mWhisper, "LOG_LEVEL_INFO", INT2NUM(GGML_LOG_LEVEL_INFO));
1507+
rb_define_const(mWhisper, "LOG_LEVEL_WARN", INT2NUM(GGML_LOG_LEVEL_WARN));
1508+
rb_define_const(mWhisper, "LOG_LEVEL_ERROR", INT2NUM(GGML_LOG_LEVEL_ERROR));
1509+
rb_define_const(mWhisper, "LOG_LEVEL_DEBUG", INT2NUM(GGML_LOG_LEVEL_DEBUG));
1510+
rb_define_const(mWhisper, "LOG_LEVEL_CONT", INT2NUM(GGML_LOG_LEVEL_CONT));
1511+
15051512
rb_define_singleton_method(mWhisper, "lang_max_id", ruby_whisper_s_lang_max_id, 0);
15061513
rb_define_singleton_method(mWhisper, "lang_id", ruby_whisper_s_lang_id, 1);
15071514
rb_define_singleton_method(mWhisper, "lang_str", ruby_whisper_s_lang_str, 1);

bindings/ruby/tests/test_whisper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def test_log_set
107107

108108
assert logs.length > 30
109109
logs.each do |log|
110+
assert_equal Whisper::LOG_LEVEL_INFO, log[0]
110111
assert_same user_data, log[2]
111112
end
112113
end

0 commit comments

Comments
 (0)