Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
454:36fd1fd06492 | 456:909306e412e2 |
---|---|
16 */ | 16 */ |
17 package org.tmatesoft.hg.console; | 17 package org.tmatesoft.hg.console; |
18 | 18 |
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 19 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
20 import static org.tmatesoft.hg.repo.HgRepository.WORKING_COPY; | 20 import static org.tmatesoft.hg.repo.HgRepository.WORKING_COPY; |
21 import static org.tmatesoft.hg.util.LogFacility.Severity.*; | |
21 | 22 |
22 import java.io.File; | 23 import java.io.File; |
23 import java.io.IOException; | 24 import java.io.IOException; |
24 import java.util.ArrayList; | 25 import java.util.ArrayList; |
25 import java.util.Collection; | 26 import java.util.Collection; |
70 import org.tmatesoft.hg.util.LogFacility; | 71 import org.tmatesoft.hg.util.LogFacility; |
71 import org.tmatesoft.hg.util.Pair; | 72 import org.tmatesoft.hg.util.Pair; |
72 import org.tmatesoft.hg.util.Path; | 73 import org.tmatesoft.hg.util.Path; |
73 import org.tmatesoft.hg.util.PathRewrite; | 74 import org.tmatesoft.hg.util.PathRewrite; |
74 import org.tmatesoft.hg.util.ProgressSupport; | 75 import org.tmatesoft.hg.util.ProgressSupport; |
76 import org.tmatesoft.hg.util.LogFacility.Severity; | |
75 | 77 |
76 /** | 78 /** |
77 * Various debug dumps. | 79 * Various debug dumps. |
78 * | 80 * |
79 * @author Artem Tikhomirov | 81 * @author Artem Tikhomirov |
248 }); | 250 }); |
249 System.out.println(); | 251 System.out.println(); |
250 } | 252 } |
251 | 253 |
252 private void testConsoleLog() { | 254 private void testConsoleLog() { |
253 LogFacility fc = new StreamLogFacility(true, true, true, System.out); | 255 LogFacility fc = new StreamLogFacility(Debug, true, System.out); |
254 System.out.printf("isDebug: %s, isInfo:%s\n", fc.isDebug(), fc.isInfo()); | 256 System.out.printf("isDebug: %s, isInfo:%s\n", fc.isDebug(), fc.getLevel() == Info); |
255 fc.debug(getClass(), "%d", 1); | 257 fc.dump(getClass(), Debug, "%d", 1); |
256 fc.info(getClass(), "%d\n", 2); | 258 fc.dump(getClass(), Info, "%d\n", 2); |
257 fc.warn(getClass(), "%d\n", 3); | 259 fc.dump(getClass(), Warn, "%d\n", 3); |
258 fc.error(getClass(), "%d", 4); | 260 fc.dump(getClass(), Error, "%d", 4); |
259 Exception ex = new Exception(); | 261 Exception ex = new Exception(); |
260 fc.debug(getClass(), ex, "message"); | 262 fc.dump(getClass(), Debug, ex, "message"); |
261 fc.info(getClass(), ex, null); | 263 fc.dump(getClass(), Info, ex, null); |
262 fc.warn(getClass(), ex, null); | 264 fc.dump(getClass(), Warn, ex, null); |
263 fc.error(getClass(), ex, "message"); | 265 fc.dump(getClass(), Error, ex, "message"); |
264 } | 266 } |
265 | 267 |
266 private void testTreeTraversal() throws Exception { | 268 private void testTreeTraversal() throws Exception { |
267 File repoRoot = hgRepo.getWorkingDir(); | 269 File repoRoot = hgRepo.getWorkingDir(); |
268 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), hgRepo.getToRepoPathHelper())); | 270 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), hgRepo.getToRepoPathHelper())); |