Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

36
LINES

< > BotCompany Repo | #1024208 // System Print Log [why not used anymore?]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (9190L/48K).

!7

// TODO: capture all of System.out/System.err

cmodule SystemPrintLog {
  int linesToShow = 100, interval = 250;
  
  transient Appendable log; // virtual NotifyingStringBuffer
  transient JFastLogView_noWrap view;
  transient long changesSeen;
  
  start {
    if (dm_getBounds() == null)
      dm_setBounds(this, 0, max(0, getHeight(dm_desktopPane())-200), 400, 200);
    log = getCreator('print_log);
    doEvery(interval, r updateMe);
  }
  
  visualize {
    ret componentPopupMenuItems(jSection("SYSTEM LOG",
      jscroll_copyBackground(view = jFastLogView_noWrap(str(log)))),
      "Clear", r { clearStringBuffer_gen(log) },
      "Copy to new window", r { scrollAllTheWayDown(maximizeFrame(showText_fast_noWrap("System Log", log))) });
  }
  
  void update {
    JFastLogView_noWrap _view = view;
    if (_view == null) ret;
    Long changes = cast getOpt(log, 'changes);
    if (changes == null || neq(changes, changesSeen)) {
      if (changes != null) changesSeen = changes;
      _view.setText(extractLastNLinesOfString(linesToShow, str(log)));
      scrollAllTheWayDown(_view);
    }
  }
}

Author comment

Began life as a copy of #1018866

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

-
Snippet ID: #1024208
Snippet name: System Print Log [why not used anymore?]
Eternal ID of this version: #1024208/9
Text MD5: 4a7c98b142f9af1d3effa023289bbbed
Transpilation MD5: 8e20d80bfd0215c4f7a2f131d2226890
Author: stefan
Category: javax / gui
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-20 16:36:16
Source code size: 1144 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 315 / 2814
Version history: 8 change(s)
Referenced in: