Mercurial > jhg
diff src/org/tmatesoft/hg/internal/FileUtils.java @ 654:12a4f60ea972
1) Console push tool. 2) Pass class to blame into FileUtils
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 03 Jul 2013 15:11:40 +0200 |
parents | ffce73efa2c2 |
children | 24f4efedc9d5 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/FileUtils.java Wed Jul 03 14:38:30 2013 +0200 +++ b/src/org/tmatesoft/hg/internal/FileUtils.java Wed Jul 03 15:11:40 2013 +0200 @@ -37,13 +37,19 @@ public final class FileUtils { private final LogFacility log; + private final Class<?> troublemaker; public static void copyFile(File from, File to) throws HgIOException { - new FileUtils(new StreamLogFacility(Debug, true, System.err)).copy(from, to); + new FileUtils(new StreamLogFacility(Debug, true, System.err), FileUtils.class).copy(from, to); } - public FileUtils(LogFacility logFacility) { + public FileUtils(LogFacility logFacility, Object troubleSource) { log = logFacility; + if (troubleSource == null) { + troublemaker = null; + } else { + troublemaker = troubleSource instanceof Class ? (Class<?>) troubleSource : troubleSource.getClass(); + } } public void copy(File from, File to) throws HgIOException { @@ -104,7 +110,7 @@ } else { msg = String.format("Failed to close %s", f); } - log.dump(getClass(), Severity.Warn, ex, msg); + log.dump(troublemaker == null ? getClass() : troublemaker, Severity.Warn, ex, msg); } } }