1 /*
2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.media.sound;
27
28 /**
29 * Printer allows you to set up global debugging status and print
30 * messages accordingly.
31 *
32 * @author David Rivas
33 * @author Kara Kytle
34 */
35 class Printer {
36
37 static final boolean err = false;
38 static final boolean debug = false;
39 static final boolean trace = false;
40 static final boolean verbose = false;
41 static final boolean release = false;
42
43 static final boolean SHOW_THREADID = false;
44 static final boolean SHOW_TIMESTAMP = false;
45
46 /*static void setErrorPrint(boolean on) {
47
48 err = on;
49 }
50
51 static void setDebugPrint(boolean on) {
52
53 debug = on;
54 }
55
56 static void setTracePrint(boolean on) {
57
58 trace = on;
59 }
60
61 static void setVerbosePrint(boolean on) {
62
63 verbose = on;
64 }
65
66 static void setReleasePrint(boolean on) {
67
68 release = on;
69 }*/
70
71 public static void err(String str) {
72
73 if (err)
74 println(str);
75 }
76
77 public static void debug(String str) {
78
79 if (debug)
80 println(str);
81 }
82
83 public static void trace(String str) {
84
85 if (trace)
86 println(str);
87 }
88
89 public static void verbose(String str) {
90
91 if (verbose)
92 println(str);
93 }
94
95 public static void release(String str) {
96
97 if (release)
98 println(str);
99 }
100
101 private static long startTime = 0;
102
103 public static void println(String s) {
104 String prepend = "";
105 if (SHOW_THREADID) {
106 prepend = "thread " + Thread.currentThread().getId() + " " + prepend;
107 }
108 if (SHOW_TIMESTAMP) {
109 if (startTime == 0) {
110 startTime = System.nanoTime() / 1000000l;
111 }
112 prepend = prepend + ((System.nanoTime()/1000000l) - startTime) + "millis: ";
113 }
114 System.out.println(prepend + s);
115 }
116
117 public static void println() {
118 System.out.println();
119 }
120
121 }