Search in sources :

Example 21 with LogTypeHelper

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;
}
Also used : JComboBox(javax.swing.JComboBox) LogTypeRenderer(com.cosylab.logging.settings.LogTypeRenderer) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) Point(java.awt.Point)

Example 22 with LogTypeHelper

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());
}
Also used : LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper)

Example 23 with LogTypeHelper

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;
}
Also used : LogTypeRenderer(com.cosylab.logging.settings.LogTypeRenderer) JComboBox(javax.swing.JComboBox) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper)

Example 24 with LogTypeHelper

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;
}
Also used : JComboBox(javax.swing.JComboBox) LogTypeRenderer(com.cosylab.logging.settings.LogTypeRenderer) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) Point(java.awt.Point)

Example 25 with LogTypeHelper

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();
}
Also used : AdditionalData(com.cosylab.logging.engine.log.ILogEntry.AdditionalData) ILogEntry(com.cosylab.logging.engine.log.ILogEntry) LogTypeHelper(com.cosylab.logging.engine.log.LogTypeHelper) LogField(com.cosylab.logging.engine.log.LogField) Date(java.util.Date) AdditionalData(com.cosylab.logging.engine.log.ILogEntry.AdditionalData)

Aggregations

LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)30 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)8 Date (java.util.Date)6 AdditionalData (com.cosylab.logging.engine.log.ILogEntry.AdditionalData)5 JComboBox (javax.swing.JComboBox)5 ExactFilter (com.cosylab.logging.engine.ExactFilter)4 MinMaxFilter (com.cosylab.logging.engine.MinMaxFilter)4 LogTypeRenderer (com.cosylab.logging.settings.LogTypeRenderer)4 Filter (com.cosylab.logging.engine.Filter)3 RegExpFilter (com.cosylab.logging.engine.RegExpFilter)3 LogEntry (com.cosylab.logging.engine.log.LogEntry)3 SystemException (org.omg.CORBA.SystemException)3 LogLevels (alma.Logging.LoggingConfigurablePackage.LogLevels)2 LogLvlSelNotSupportedException (alma.acs.gui.loglevel.LogLvlSelNotSupportedException)2 AcsLogLevelDefinition (alma.acs.logging.level.AcsLogLevelDefinition)2 IsoDateFormat (alma.acs.util.IsoDateFormat)2 GridBagLayout (java.awt.GridBagLayout)2 Point (java.awt.Point)2 FieldPosition (java.text.FieldPosition)2 SimpleDateFormat (java.text.SimpleDateFormat)2