01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.data.shapefile;
17:
18: import java.util.logging.Logger;
19:
20: public class StreamLogging {
21: private static final Logger LOGGER = org.geotools.util.logging.Logging
22: .getLogger("org.geotools.data.shapefile");
23:
24: private String name;
25: private int open = 0;
26:
27: /**
28: * The name that will appear in the debug message
29: * @param name
30: */
31: public StreamLogging(String name) {
32: this .name = name;
33: }
34:
35: /**
36: * Call when reader or writer is opened
37: */
38: public synchronized void open() {
39: open++;
40: LOGGER.finest(name + " has been opened. Number open: " + open);
41: }
42:
43: public synchronized void close() {
44: open--;
45: LOGGER.finest(name + " has been closed. Number open: " + open);
46: }
47:
48: }
|