~ubuntu-branches/ubuntu/oneiric/electric/oneiric

« back to all changes in this revision

Viewing changes to com/sun/electric/tool/simulation/test/Logger.java

  • Committer: Bazaar Package Importer
  • Author(s): Onkar Shinde
  • Date: 2010-01-09 16:26:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100109162604-1ypvmy8ijmlc6oq7
Tags: 8.10-1
* New upstream version.
* debian/control
  - Add libjava3d-java and quilt build dependencies.
  - Update standards version to 3.8.3.
  - Add libjava3d-java as recommends to binary package.
* debian/rules
  - Use quilt patch system instead of simple patchsys.
  - Add java3d related jar files to DEB_JARS.
* debian/patches/*
  - Update as per current upstream source. Convert to quilt.
* debian/ant.properties
  - Do not disable 3D plugin anymore.
  - Use new property to disable compilation of OS X related classes.
* debian/wrappers/electric
  - Add java3d related jar files to runtime classpath.
* debian/README.source
  - Change text to the appropriate one for quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.sun.electric.tool.simulation.test;
 
2
 
 
3
/* Logger.java
 
4
 * 
 
5
 * Copyright (c) 2005 by Sun Microsystems, Inc.
 
6
 *
 
7
 * Created on March 18, 2005
 
8
 */
 
9
 
 
10
/**
 
11
 * Provides user-configurable diagnostic messages to device classes that extend
 
12
 * this class. Initialization messages can be turned on or off for all
 
13
 * <code>Logger</code> descendents. Once a device object is created, the user
 
14
 * can use {@link #setLogSets}&nbsp; and {@link #setLogOthers}&nbsp; to
 
15
 * control the object's individual logging characteristics. In this manner, the
 
16
 * user can enable messages only from particular devices.
 
17
 * 
 
18
 * @author Tom O'Neill (toneill)
 
19
 */
 
20
public abstract class Logger {
 
21
 
 
22
    /** Whether to report device initialization */
 
23
    private static boolean logInits = false;
 
24
 
 
25
    /** Whether to report set (configure) events */
 
26
    private boolean logSets = false;
 
27
 
 
28
    /** Whether to report events other than set events */
 
29
    private boolean logOthers = false;
 
30
 
 
31
    public String toString() {
 
32
        return "Logger: logSets=" + isLogSets() + ", logOthers="
 
33
                + isLogOthers();
 
34
    }
 
35
 
 
36
    /**
 
37
     * @return Returns whether to report all device initialization.
 
38
     */
 
39
    public static boolean isLogInits() {
 
40
        return logInits;
 
41
    }
 
42
 
 
43
    /**
 
44
     * Set whether to report initialization of all devices.
 
45
     * 
 
46
     * @param logInits
 
47
     *            whether to report device initialization
 
48
     */
 
49
    public static void setLogInits(boolean logInits) {
 
50
        Logger.logInits = logInits;
 
51
    }
 
52
 
 
53
    //    /**
 
54
    //     * Copy the logging state of this object to the destination
 
55
    //     *
 
56
    //     * @param source
 
57
    //     * <code>Logger</code> to copy state to
 
58
    //     */
 
59
    //    void copyFrom(Logger source) {
 
60
    //        logSets = source.logSets;
 
61
    //        logOthers = source.logOthers;
 
62
    //    }
 
63
 
 
64
    /**
 
65
     * @return Returns whether to report set (configure) events
 
66
     */
 
67
    public boolean isLogSets() {
 
68
        return logSets;
 
69
    }
 
70
 
 
71
    /**
 
72
     * Set whether to report set (configure) events, such as voltage setting
 
73
     * 
 
74
     * @param logSets
 
75
     *            whether to report set events
 
76
     */
 
77
    public void setLogSets(boolean logSets) {
 
78
        this.logSets = logSets;
 
79
    }
 
80
 
 
81
    /**
 
82
     * @return Returns whether to report occurences other than initialization
 
83
     *         and set events
 
84
     */
 
85
    public boolean isLogOthers() {
 
86
        return logOthers;
 
87
    }
 
88
 
 
89
    /**
 
90
     * Set whether to report occurences other than initialization and set
 
91
     * events.
 
92
     * 
 
93
     * @param logOthers
 
94
     *            whether to report occurences other than initialization and set
 
95
     *            events
 
96
     */
 
97
    public void setLogOthers(boolean logOthers) {
 
98
        this.logOthers = logOthers;
 
99
    }
 
100
 
 
101
    /**
 
102
     * Set all optional diagnostic messages on or off
 
103
     * 
 
104
     * @param log
 
105
     *            whether to print optional diagnostic messages
 
106
     */
 
107
    public void setAllLogging(boolean log) {
 
108
        setLogSets(log);
 
109
        setLogOthers(log);
 
110
    }
 
111
 
 
112
    /**
 
113
     * Display message <code>msg</code> on <code>stdout</code> when
 
114
     * initialization-logging is enabled.
 
115
     * 
 
116
     * @param msg
 
117
     *            message to print
 
118
     */
 
119
    protected static void logInit(String msg) {
 
120
        if (isLogInits() == true) {
 
121
            System.out.println(msg);
 
122
        }
 
123
    }
 
124
 
 
125
    /**
 
126
     * Display message <code>msg</code> on <code>stdout</code> when
 
127
     * set-logging is enabled.
 
128
     * 
 
129
     * @param msg
 
130
     *            message to print
 
131
     */
 
132
    protected void logSet(String msg) {
 
133
        if (isLogSets() == true) {
 
134
            System.out.println(msg);
 
135
        }
 
136
    }
 
137
 
 
138
    /**
 
139
     * Display message <code>msg</code> on <code>stdout</code> when "other"
 
140
     * logging is enabled.
 
141
     * 
 
142
     * @param msg
 
143
     *            message to print
 
144
     */
 
145
    protected void logOther(String msg) {
 
146
        if (isLogOthers() == true) {
 
147
            System.out.println(msg);
 
148
        }
 
149
    }
 
150
}