use of com.cosylab.logging.engine.log.LogTypeHelper in project ACS by ACS-Community.
the class ZoomPrefsDlg method buildLogLevelCB.
/**
* Build a log level combobox.
*
* @param initialLevel The initial log level
* @return The log level CB
*/
private JComboBox buildLogLevelCB(LogTypeHelper initialLevel) {
JComboBox temp;
// Add the ComboBox for the log level
LogTypeHelper[] types = LogTypeHelper.values();
int t = 0;
temp = new JComboBox(types);
// Build the renderer for the combo boxes
LogTypeRenderer rendererCB = new LogTypeRenderer();
if (initialLevel != null) {
temp.setSelectedItem(initialLevel);
} else {
temp.setSelectedItem(LogTypeHelper.TRACE);
}
temp.setEditable(false);
temp.setMaximumRowCount(LogTypeHelper.values().length);
temp.setRenderer(rendererCB);
return temp;
}
use of com.cosylab.logging.engine.log.LogTypeHelper in project ACS by ACS-Community.
the class CommandLineParser method printUsage.
/**
* Print the standard usage message if the parameters in the command
* line are wrong.
*
* @param errorMsg An optional error message to print
*/
public static void printUsage(String errorMsg) {
if (errorMsg != null) {
System.err.println("Error parsing the command line: " + errorMsg);
}
StringBuilder str = new StringBuilder("USAGE:\n");
str.append("jlog [logFileName] ");
str.append("[-h|--help] ");
str.append("[(-f|--filter) <filterFileName>] ");
str.append("[(-e|--engineFilter) <filterFileName>]");
str.append("[(-d|--discard) (NONE|discard level)] ");
str.append("[-dnc|--DoNotConnect] ");
str.append("[-u|--unlimited] ");
str.append("[(-l|--load) <logFileName>] ");
str.append("[(-a|--audience) <audience>]\n");
str.append("Options:\n");
str.append("-h|--help: print this message and exit\n");
str.append("-f|--filter <fileName>: load the filters in <fileName> in the table\n");
str.append("-e|--engineFilter <fileName>: load the filters in <fileName> in the engine\n");
str.append("-d|--discard <level>: set the discard level at startup; NONE means no discard level\n");
str.append(" Valid discard levels are:");
str.append("\tNone");
for (LogTypeHelper logType : LogTypeHelper.values()) {
str.append('\t');
str.append(logType);
str.append('\n');
}
str.append("-dnc|--DoNotConnect: do not connect to ACS\n");
str.append("-u|--unlimited: do not limit the number of logs in the table\n");
str.append("-l|--load <logFileName>: load the <logFileName> file of logs in the table\n");
str.append("-a|--audience <audience>: set the audience\n");
str.append(" Available audiences are:\n");
for (String aName : AudienceInfo.getShortNames()) {
str.append('\t');
str.append(aName);
str.append('\n');
}
str.append('\n');
System.out.println(str.toString());
}
use of com.cosylab.logging.engine.log.LogTypeHelper in project ACS by ACS-Community.
the class LogToolBar method getDiscardLevelCB.
/**
*
* @return The discard level CB
*/
public JComboBox getDiscardLevelCB() {
if (discardLevelCB == null) {
// Add the ComboBox for the log level
LogTypeRenderer discardRendererCB = new LogTypeRenderer();
String[] discardLevelStr = new String[LogTypeHelper.values().length + 1];
discardLevelStr[0] = "None";
int t = 0;
for (LogTypeHelper logType : LogTypeHelper.values()) {
discardLevelStr[++t] = logType.logEntryType;
}
discardLevelCB = new JComboBox(discardLevelStr);
discardLevelCB.setMaximumRowCount(discardLevelStr.length);
if (initialDiscardLevel == null) {
discardLevelCB.setSelectedIndex(0);
} else {
discardLevelCB.setSelectedIndex(initialDiscardLevel.ordinal() + 1);
}
discardLevelCB.setEditable(false);
discardLevelCB.setRenderer(discardRendererCB);
}
return discardLevelCB;
}
use of com.cosylab.logging.engine.log.LogTypeHelper in project ACS by ACS-Community.
the class QueryDlg method setupTypeCB.
private JComboBox setupTypeCB(JComboBox box) {
String[] Descritpions = new String[LogTypeHelper.values().length];
int t = 0;
for (LogTypeHelper log : LogTypeHelper.values()) {
Descritpions[t++] = log.logEntryType;
}
JComboBox logLevelCB = new JComboBox(Descritpions);
// Build the renderer for the combo boxesx
LogTypeRenderer rendererCB = new LogTypeRenderer();
logLevelCB.setEditable(false);
logLevelCB.setMaximumRowCount(LogTypeHelper.values().length);
logLevelCB.setRenderer(rendererCB);
return logLevelCB;
}
use of com.cosylab.logging.engine.log.LogTypeHelper in project ACS by ACS-Community.
the class LogFileCache method toCacheString.
protected String toCacheString(ILogEntry log) {
sb.delete(0, sb.length());
for (LogField field : LogField.values()) {
Object obj = log.getField(field);
if (obj != null) {
if (obj instanceof Date) {
sb.append(((Date) obj).getTime());
} else if (obj instanceof LogTypeHelper) {
sb.append(((LogTypeHelper) obj).ordinal());
} else {
sb.append(obj.toString());
}
}
sb.append((char) 0);
}
if (log.hasDatas()) {
Vector<ILogEntry.AdditionalData> datas = log.getAdditionalData();
for (int t = 0; t < datas.size(); t++) {
ILogEntry.AdditionalData data = datas.get(t);
sb.append(data.name);
sb.append(SEPARATOR);
sb.append(data.value);
sb.append(SEPARATOR);
}
}
return sb.toString();
}
Aggregations