Skip to content

Commit faaabb6

Browse files
committed
Add zero-argument versions of logger methods
The add method already handled nil msg, but the main level methods strictly required an argument.
1 parent 7517b82 commit faaabb6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/main/java/org/jruby/rack/ext/Logger.java

+25
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ public IRubyObject info(final ThreadContext context,
290290
return context.runtime.newBoolean( add(INFO, context, msg, block) );
291291
}
292292

293+
@JRubyMethod(name = "info")
294+
public IRubyObject info(final ThreadContext context, final Block block) {
295+
return info(context, context.nil, block);
296+
}
297+
293298
//
294299
// Log a +WARN+ message.
295300
//
@@ -299,6 +304,11 @@ public IRubyObject warn(final ThreadContext context,
299304
return context.runtime.newBoolean( add(WARN, context, msg, block) );
300305
}
301306

307+
@JRubyMethod(name = "warn")
308+
public IRubyObject warn(final ThreadContext context, final Block block) {
309+
return warn(context, context.nil, block);
310+
}
311+
302312
//
303313
// Log a +ERROR+ message.
304314
//
@@ -308,6 +318,11 @@ public IRubyObject error(final ThreadContext context,
308318
return context.runtime.newBoolean( add(ERROR, context, msg, block) );
309319
}
310320

321+
@JRubyMethod(name = "error")
322+
public IRubyObject error(final ThreadContext context, final Block block) {
323+
return error(context, context.nil, block);
324+
}
325+
311326
//
312327
// Log a +FATAL+ message.
313328
//
@@ -317,6 +332,11 @@ public IRubyObject fatal(final ThreadContext context,
317332
return context.runtime.newBoolean( add(FATAL, context, msg, block) );
318333
}
319334

335+
@JRubyMethod(name = "fatal")
336+
public IRubyObject fatal(final ThreadContext context, final Block block) {
337+
return fatal(context, context.nil, block);
338+
}
339+
320340
//
321341
// Log an +UNKNOWN+ message.
322342
// This will be printed no matter what the logger's level is.
@@ -328,6 +348,11 @@ public IRubyObject unknown(final ThreadContext context,
328348
return context.runtime.newBoolean( add(UNKNOWN, context, msg, block) );
329349
}
330350

351+
@JRubyMethod(name = "unknown")
352+
public IRubyObject unknown(final ThreadContext context, final Block block) {
353+
return unknown(context, context.nil, block);
354+
}
355+
331356
// def add(severity, message = nil, progname = nil, &block)
332357
@JRubyMethod(name = "add", required = 1, optional = 2)
333358
public IRubyObject add(final ThreadContext context,

0 commit comments

Comments
 (0)