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();
}
use of com.cosylab.logging.engine.log.LogTypeHelper in project ACS by ACS-Community.
the class TotalStatisticsPnl method initialize.
/**
* Init the GUI
*/
private void initialize() {
JPanel timestampPnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
timestampPnl.add(new JLabel("Data last updated at"));
timestampPnl.add(timestampLbl);
setLayout(new BorderLayout());
add(timestampPnl, BorderLayout.NORTH);
// The logs
JPanel logsPnl = new JPanel();
logsPnl.setBorder(BorderFactory.createTitledBorder("Total num. of logs"));
add(logsPnl, BorderLayout.CENTER);
Insets insets1 = new Insets(2, 2, 2, 5);
GridBagLayout gb = new GridBagLayout();
GridBagConstraints constr = new GridBagConstraints();
logsPnl.setLayout(gb);
constr.insets = insets1;
constr.fill = GridBagConstraints.NONE;
constr.anchor = GridBagConstraints.LINE_START;
constr.weightx = 0.5;
for (int t = 0; t < LogTypeHelper.values().length; t++) {
LogTypeHelper logType = LogTypeHelper.values()[t];
constr.gridx = 0;
constr.gridy = t;
JLabel lbl = new JLabel(logType.toString());
gb.setConstraints(lbl, constr);
logsPnl.add(lbl);
constr.gridx = 1;
constr.gridy = t;
totLogTypes[t] = new JLabel("0");
gb.setConstraints(totLogTypes[t], constr);
logsPnl.add(totLogTypes[t]);
}
add(logsPnl, BorderLayout.CENTER);
// The numbers
JPanel globalPnl = new JPanel();
Insets insets = new Insets(2, 2, 2, 5);
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
c.insets = insets;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.LINE_START;
c.weightx = 0.5;
globalPnl.setLayout(gridbag);
globalPnl.setBorder(BorderFactory.createTitledBorder("Global"));
c.gridx = 0;
c.gridy = 0;
JLabel totLbl = new JLabel("Total logs:");
gridbag.setConstraints(totLbl, c);
globalPnl.add(totLbl);
c.gridx = 1;
c.gridy = 0;
gridbag.setConstraints(totNumOfLogsLbl, c);
globalPnl.add(totNumOfLogsLbl);
c.gridx = 0;
c.gridy = 1;
JLabel errorLbl = new JLabel("Errors parsing XML:");
gridbag.setConstraints(errorLbl, c);
globalPnl.add(errorLbl);
c.gridx = 1;
c.gridy = 1;
gridbag.setConstraints(totParsingErrsLbl, c);
globalPnl.add(totParsingErrsLbl);
c.gridx = 0;
c.gridy = 2;
JLabel shortLbl = new JLabel("Length of shortest XML log");
gridbag.setConstraints(shortLbl, c);
globalPnl.add(shortLbl);
c.gridx = 1;
c.gridy = 2;
gridbag.setConstraints(shortestLogLbl, c);
globalPnl.add(shortestLogLbl);
c.gridx = 0;
c.gridy = 3;
JLabel longLbl = new JLabel("Length of longest XML log");
gridbag.setConstraints(longLbl, c);
globalPnl.add(longLbl);
c.gridx = 1;
c.gridy = 3;
gridbag.setConstraints(longestLogLbl, c);
globalPnl.add(longestLogLbl);
add(globalPnl, BorderLayout.SOUTH);
}
Aggregations