Fix various usages of the Flogger API

- Don't use String.format; instead pass the string directly and let
  Flogger do the formatting. This means the formatting is only done
  when thte log level is enabled.

- Pass exception via withCause rather than as an unreferenced vararg.

- When explicitly passing an exception as vararg with the intention of
  not logging a stack trace, call getMessage() instead of just passing
  the exception object.

Change-Id: Icfe0712b5ebd1d05c630363853a311d734674d14
This commit is contained in:
David Pursehouse
2020-04-27 08:49:26 +09:00
parent c91487abbd
commit ec43a2f070
4 changed files with 8 additions and 9 deletions

View File

@@ -157,11 +157,11 @@ public class Text extends RawText {
return Charset.forName(encoding);
} catch (IllegalCharsetNameException err) {
logger.atSevere().log("Invalid detected charset name '%s': %s", encoding, err);
logger.atSevere().log("Invalid detected charset name '%s': %s", encoding, err.getMessage());
return ISO_8859_1;
} catch (UnsupportedCharsetException err) {
logger.atSevere().log("Detected charset '%s' not supported: %s", encoding, err);
logger.atSevere().log("Detected charset '%s' not supported: %s", encoding, err.getMessage());
return ISO_8859_1;
}
}