/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*
* Debug class
*/
/**
* A simple configurable debug logging class.
* <p>
*
* Calling member classes <b>message()</b>, <b>warning()</b>,
* <b>error()</b>, and <b>fatal()</b> causes a log entry to be
* generated if the current verbosity level is greater than or equal
* to the specified severity.
* <p>
*
* Calling <b>setDebugLevel()</b> sets the verbosity level, which is a
* threshold of severity below which messages will not be logged. The
* verbosity level can be set at any time.
* <p>
*
* For example, setting the verbosity level to <b>Debug.ERROR</b>
* means that only <b>error()</b> and <b>fatal()</b> calls will
* generate log entries, while setting the level to <b>WARNING</b>
* will log <b>warning()</b> calls as well as <b>error()</b> and
* <b>fatal()</b> while ignoring <b>message()</b>.
* <p>
*
* Setting the verbosity level to <b>ALL</b> is equivalent to setting
* it to <b>MESSAGE</b>; all calls are logged. The constant
* <b>NONE</b> suppresses logging of all calls.
* <p>
*
* The verbosity level can be set globally or on a class-by-class
* basis. Use the form of <b>setDebugLevel()</b> which takes an
* argument of type Object to set the level for all instances of the
* specified class.
* <p>
*
* Using the forms of <b>message()</b>, <b>warning()</b>,
* <b>error()</b>, and <b>fatal()</b> which accept an argument of type
* Object will use the verbosity value associated with the specified
* class. If no value has been explicitly set for the class, the
* global default will be used.
* <p>
*
* At present log messages are written only to stdout.
* An enhancement would be to implement an interface to the syslog facility.
*/
public class Debug {
/**
* Log a highest-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a high-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a medium-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a low-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a lowest-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a highest-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a high-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a medium-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a low-priority message.
* @param String s The message to be logged.
*/
}
/**
* Log a lowest-priority message.
* @param String s The message to be logged.
*/
}
/**
* Set the verbosity level to the specified severity.
* @param String s The message to be logged.
*/
return;
}
/**
* Set the verbosity level to the specified severity.
* @param String s The message to be logged.
*/
return;
/*
* System.out.println("Debug: class " + o.getClass().getName() +
* " level = " + classDB.get(o.getClass()));
*/
}
return;
try {
} catch (Exception x) {
}
}
if (lvl < globalDebugLevel)
return;
debugPrint(s);
}
if (lvl < getLevelForClass(o))
return;
debugPrint(s);
}
/*
* get debug level for o's class, if already there
* otherwise create an entry for o and set it to the global level
*/
int lvl = globalDebugLevel;
Object g;
else
/*
* System.out.println("Debug: getLevelForClass " +
* o.getClass().getName() +
* " = " + lvl);
*/
return lvl;
}
// here is where we could hide syslog or file destination...
}
theInstance = o;
}
return;
}
fatal(theInstance, s);
}
warning(theInstance, s);
}
error(theInstance, s);
}
message(theInstance, s);
}
info(theInstance, s);
}
/*
* Verbosity level to suppress all messages.
*/
/*
* Verbosity level to log only highest-priority messages.
*/
/*
* Verbosity level to log high- and highest-priority messages.
*/
/*
* Verbosity level to log medium-, high-, and highest-priority messages.
*/
/*
* Verbosity level to log low-, medium-, high-, and
* highest-priority messages.
*/
/*
* Verbosity level to log lowest-, low-, medium-, high-, and
* highest-priority messages.
*/
/*
* Verbosity level to log all messages.
*/
}