From d2cc34dd8afe7b9eaff75a48f68319e5f84053a5 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Sun, 12 Nov 2017 11:30:49 -0500 Subject: [PATCH] Add formatted string function to LogWriter. Need to be careful with escapes though. --- java/com/tigervnc/rfb/LogWriter.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/java/com/tigervnc/rfb/LogWriter.java b/java/com/tigervnc/rfb/LogWriter.java index ca7d06ac..4c66e49c 100644 --- a/java/com/tigervnc/rfb/LogWriter.java +++ b/java/com/tigervnc/rfb/LogWriter.java @@ -35,10 +35,18 @@ public class LogWriter { } } - public void error(String str) { write(0, str); } - public void status(String str) { write(10, str); } - public void info(String str) { write(30, str); } - public void debug(String str) { write(100, str); } + public void error(String fmt, Object... args) { + write(0, String.format(fmt, args)); + } + public void status(String fmt, Object... args) { + write(10, String.format(fmt, args)); + } + public void info(String fmt, Object... args) { + write(30, String.format(fmt, args)); + } + public void debug(String fmt, Object... args) { + write(100, String.format(fmt, args)); + } public static boolean setLogParams(String params) { globalLogLevel = Integer.parseInt(params); -- 2.39.5