Mercurial > jhg
diff cmdline/org/tmatesoft/hg/console/Main.java @ 456:909306e412e2
Refactor LogFacility and SessionContext, better API for both
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 18 Jun 2012 16:54:00 +0200 |
parents | 6865eb742883 |
children | 7bcfbc255f48 |
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java Wed Jun 13 21:07:39 2012 +0200 +++ b/cmdline/org/tmatesoft/hg/console/Main.java Mon Jun 18 16:54:00 2012 +0200 @@ -18,6 +18,7 @@ import static org.tmatesoft.hg.repo.HgRepository.TIP; import static org.tmatesoft.hg.repo.HgRepository.WORKING_COPY; +import static org.tmatesoft.hg.util.LogFacility.Severity.*; import java.io.File; import java.io.IOException; @@ -72,6 +73,7 @@ import org.tmatesoft.hg.util.Path; import org.tmatesoft.hg.util.PathRewrite; import org.tmatesoft.hg.util.ProgressSupport; +import org.tmatesoft.hg.util.LogFacility.Severity; /** * Various debug dumps. @@ -250,17 +252,17 @@ } private void testConsoleLog() { - LogFacility fc = new StreamLogFacility(true, true, true, System.out); - System.out.printf("isDebug: %s, isInfo:%s\n", fc.isDebug(), fc.isInfo()); - fc.debug(getClass(), "%d", 1); - fc.info(getClass(), "%d\n", 2); - fc.warn(getClass(), "%d\n", 3); - fc.error(getClass(), "%d", 4); + LogFacility fc = new StreamLogFacility(Debug, true, System.out); + System.out.printf("isDebug: %s, isInfo:%s\n", fc.isDebug(), fc.getLevel() == Info); + fc.dump(getClass(), Debug, "%d", 1); + fc.dump(getClass(), Info, "%d\n", 2); + fc.dump(getClass(), Warn, "%d\n", 3); + fc.dump(getClass(), Error, "%d", 4); Exception ex = new Exception(); - fc.debug(getClass(), ex, "message"); - fc.info(getClass(), ex, null); - fc.warn(getClass(), ex, null); - fc.error(getClass(), ex, "message"); + fc.dump(getClass(), Debug, ex, "message"); + fc.dump(getClass(), Info, ex, null); + fc.dump(getClass(), Warn, ex, null); + fc.dump(getClass(), Error, ex, "message"); } private void testTreeTraversal() throws Exception {