Mercurial > hg > digilib-old
annotate servlet/src/digilib/Utils.java @ 108:ffc7d9138397
Updated for alcatraz/digilib 1.3 and up.
author | robcast |
---|---|
date | Tue, 13 May 2003 23:40:34 +0200 |
parents | 5d44cd2481a5 |
children |
rev | line source |
---|---|
1 | 1 /* Utils -- general utility classes for scaler servlet |
2 | |
3 Digital Image Library servlet components | |
4 | |
5 Copyright (C) 2001, 2002 Robert Casties (robcast@mail.berlios.de) | |
6 | |
7 This program is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Please read license.txt for the full details. A copy of the GPL | |
13 may be found at http://www.gnu.org/copyleft/lgpl.html | |
14 | |
15 You should have received a copy of the GNU General Public License | |
16 along with this program; if not, write to the Free Software | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 */ | |
20 | |
21 package digilib; | |
22 | |
23 public class Utils { | |
24 | |
87 | 25 private int debugLevel = 10; |
26 | |
1 | 27 public Utils() { |
28 } | |
29 | |
30 public Utils(int dbg) { | |
31 debugLevel = dbg; | |
32 } | |
59
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
33 |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
34 public void setDebugLevel(int lvl) { |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
35 debugLevel = lvl; |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
36 } |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
37 public int getDebugLevel() { |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
38 return debugLevel; |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
39 } |
8d9a0abf3626
Utils now has a setter for debugLevel. DocumentBean now properly sets
robcast
parents:
1
diff
changeset
|
40 |
1 | 41 /** |
42 * Debugging help | |
43 * dprintln(1, "blabla"); | |
44 * will be printed on stdout if debug >= 1 | |
45 */ | |
71 | 46 public void dprintln(int dbg, String s) { |
1 | 47 if (debugLevel >= dbg) { |
48 String ind = ""; | |
49 // indent by debuglevel | |
50 for (int i = 0; i < dbg; i++) { | |
51 ind += " "; | |
52 } | |
53 System.out.println(ind+s); | |
54 } | |
55 } | |
56 } |