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

40
LINES

< > BotCompany Repo | #1018866 // System Print Log [LIVE]

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

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

1  
!7
2  
3  
set flag standardTitlePopupMenu_noProgramFunctions.
4  
svoid restart() {} // help out transpiler who should honor ifndefs better
5  
svoid duplicateThisProgram() {}
6  
7  
// TODO: capture all of System.out/System.err
8  
9  
cmodule SystemPrintLog {
10  
  int linesToShow = 100, interval = 250;
11  
  
12  
  transient Appendable log; // virtual NotifyingStringBuffer
13  
  transient JFastLogView_noWrap view;
14  
  transient long changesSeen;
15  
  
16  
  start {
17  
    if (dm_getBounds() == null)
18  
      dm_setBounds(this, 0, max(0, getHeight(dm_desktopPane())-200), 400, 200);
19  
    log = getCreator('print_log);
20  
    doEvery(interval, r updateMe);
21  
  }
22  
  
23  
  visualize {
24  
    ret componentPopupMenuItems(jSection("SYSTEM LOG",
25  
      jscroll_copyBackground(view = jFastLogView_noWrap(str(log)))),
26  
      "Clear", r { clearStringBuffer_gen(log) },
27  
      "Copy to new window", r {  scrollAllTheWayDown(maximizeFrame(showText_fast_noWrap("System Log", log))) });
28  
  }
29  
  
30  
  void update {
31  
    JFastLogView_noWrap _view = view;
32  
    if (_view == null) ret;
33  
    Long changes = cast getOpt(log, 'changes);
34  
    if (changes == null || neq(changes, changesSeen)) {
35  
      if (changes != null) changesSeen = changes;
36  
      _view.setText(extractLastNLinesOfString(linesToShow, str(log)));
37  
      scrollAllTheWayDown(_view);
38  
    }
39  
  }
40  
}

Author comment

Began life as a copy of #1016189

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hpgrupgrauku, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, qmtsvidgarql, tvejysmllsmz, unoaxrwscvea, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1018866
Snippet name: System Print Log [LIVE]
Eternal ID of this version: #1018866/20
Text MD5: 0f8d10a65331090bfb4f1addfd4535df
Transpilation MD5: 33113bc226891045f131515e87b74c32
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:33
Source code size: 1308 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 389 / 515434
Version history: 19 change(s)
Referenced in: [show references]