diff --git a/source/net/filebot/Logging.java b/source/net/filebot/Logging.java index 0743795f..caab1d82 100644 --- a/source/net/filebot/Logging.java +++ b/source/net/filebot/Logging.java @@ -96,6 +96,15 @@ public final class Logging { }; } + public static Supplier cause(String m, Throwable t) { + return () -> { + StringBuilder s = new StringBuilder(m).append(": "); + s.append(t.getClass().getSimpleName()).append(": "); + s.append(t.getMessage()); + return s.toString(); + }; + } + public static Supplier cause(Throwable t) { return () -> { StringBuilder s = new StringBuilder(); diff --git a/source/net/filebot/media/XattrMetaInfo.java b/source/net/filebot/media/XattrMetaInfo.java index 0b4e0aa4..376f7573 100644 --- a/source/net/filebot/media/XattrMetaInfo.java +++ b/source/net/filebot/media/XattrMetaInfo.java @@ -2,7 +2,6 @@ package net.filebot.media; import static net.filebot.Logging.*; import static net.filebot.Settings.*; -import static net.filebot.util.ExceptionUtilities.*; import java.io.File; import java.util.Locale; @@ -70,7 +69,7 @@ public class XattrMetaInfo { try { return cache.computeIfAbsent(file, element -> compute.apply(xattr(file))); } catch (Throwable e) { - debug.warning("Failed to read xattr: " + getRootCauseMessage(e)); + debug.warning(cause("Failed to read xattr", e)); } return null; } @@ -95,7 +94,7 @@ public class XattrMetaInfo { xattr.get().setCreationDate(t); } } catch (Throwable e) { - debug.warning("Failed to set creation date: " + getRootCauseMessage(e)); + debug.warning(cause("Failed to set creation date", e)); } } @@ -117,7 +116,7 @@ public class XattrMetaInfo { } } } catch (Throwable e) { - debug.warning("Failed to set xattr: " + getRootCauseMessage(e)); + debug.warning(cause("Failed to set xattr", e)); } } @@ -130,7 +129,7 @@ public class XattrMetaInfo { try { xattr(file).clear(); } catch (Throwable e) { - debug.warning("Failed to clear xattr: " + getRootCauseMessage(e)); + debug.warning(cause("Failed to clear xattr", e)); } } }