Changeset b76b2ef


Ignore:
Timestamp:
Feb 23, 2019 6:02:00 PM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
7ce539a
Parents:
32797dd4
Message:

Console: Flip order of router logs

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/LogsHelper.java

    r32797dd4 rb76b2ef  
    115115    }
    116116   
    117     /*****  unused
    118     public String getConnectionLogs() {
    119         return formatMessages(_context.commSystem().getMostRecentErrorMessages());
    120     }
    121     ******/
    122 
    123117    private final static String NL = System.getProperty("line.separator");
    124118
    125     /** formats in reverse order */
     119    /** formats in forward order */
    126120    private String formatMessages(List<String> msgs) {
    127121        if (msgs.isEmpty())
     
    130124        StringBuilder buf = new StringBuilder(16*1024);
    131125        buf.append("</td></tr><tr><td><ul>");
    132         for (int i = msgs.size() - 1; i >= 0; i--) {
     126        // newest first
     127        // for (int i = msgs.size() - 1; i >= 0; i--) {
     128        // oldest first
     129        for (int i = 0; i < msgs.size(); i++) {
    133130            String msg = msgs.get(i);
    134131            // don't display the dup message if it is last
    135             if (i == 0 && msg.contains("&darr;"))
     132            //if (i == 0 && msg.contains("&darr;"))
     133            // don't display the dup message if it is first
     134            if (i == 0 && msg.contains("&uarr;"))
    136135                break;
    137136            msg = msg.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
    138             msg = msg.replace("&amp;darr;", "&darr;");  // hack - undo the damage (LogWriter)
     137            //msg = msg.replace("&amp;darr;", "&darr;");  // hack - undo the damage (LogWriter)
     138            msg = msg.replace("&amp;uarr;", "&uarr;");  // hack - undo the damage (LogWriter)
    139139            // remove  last \n that LogRecordFormatter added
    140140            if (msg.endsWith(NL))
  • core/java/src/net/i2p/util/LogWriter.java

    r32797dd4 rb76b2ef  
    2525    private final static long MIN_FLUSH_INTERVAL = 2*1000;
    2626    private final static long MAX_FLUSH_INTERVAL = 5*60*1000;
     27    // true for newest first on /logs page; false for oldest first
     28    private static final boolean BUFFER_DISPLAYED_REVERSE = false;
    2729    private long _lastReadConfig;
    2830    protected final LogManager _manager;
     
    138140     */
    139141    private void writeDupMessage(int dupCount, LogRecord lastRecord) {
    140         String dmsg = dupMessage(dupCount, lastRecord, false);
     142        String dmsg = dupMessage(dupCount, lastRecord, false, false);
    141143        writeRecord(lastRecord.getPriority(), dmsg);
    142144        if (_manager.getDisplayOnScreenLevel() <= lastRecord.getPriority() && _manager.displayOnScreen())
    143145            System.out.print(dmsg);
    144         dmsg = dupMessage(dupCount, lastRecord, true);
     146        dmsg = dupMessage(dupCount, lastRecord, BUFFER_DISPLAYED_REVERSE, true);
    145147        _manager.getBuffer().add(dmsg);
    146148        if (lastRecord.getPriority() >= Log.CRIT)
     
    152154     *  @since 0.9.3
    153155     */
    154     private String dupMessage(int dupCount, LogRecord lastRecord, boolean reverse) {
    155         String arrows = reverse ? (SystemVersion.isAndroid() ? "vvv" : "&darr;&darr;&darr;") : "^^^";
     156    private String dupMessage(int dupCount, LogRecord lastRecord, boolean reverse, boolean html) {
     157        boolean nohtml = !html || SystemVersion.isAndroid();
     158        String arrows = reverse ? (nohtml ? "vvv" : "&darr;&darr;&darr;")
     159                                : (nohtml ? "^^^" : "&uarr;&uarr;&uarr;");
    156160        return LogRecordFormatter.getWhen(_manager, lastRecord) + ' ' + arrows + ' ' +
    157161               _t(dupCount, "1 similar message omitted", "{0} similar messages omitted") + ' ' + arrows +
Note: See TracChangeset for help on using the changeset viewer.