Uses 911K of libraries. Click here for Pure Java version (9190L/48K).
| 1 | !7 | 
| 2 | |
| 3 | // TODO: capture all of System.out/System.err | 
| 4 | |
| 5 | cmodule SystemPrintLog {
 | 
| 6 | int linesToShow = 100, interval = 250; | 
| 7 | |
| 8 | transient Appendable log; // virtual NotifyingStringBuffer | 
| 9 | transient JFastLogView_noWrap view; | 
| 10 | transient long changesSeen; | 
| 11 | |
| 12 |   start {
 | 
| 13 | if (dm_getBounds() == null) | 
| 14 | dm_setBounds(this, 0, max(0, getHeight(dm_desktopPane())-200), 400, 200); | 
| 15 |     log = getCreator('print_log);
 | 
| 16 | doEvery(interval, r updateMe); | 
| 17 | } | 
| 18 | |
| 19 |   visualize {
 | 
| 20 |     ret componentPopupMenuItems(jSection("SYSTEM LOG",
 | 
| 21 | jscroll_copyBackground(view = jFastLogView_noWrap(str(log)))), | 
| 22 |       "Clear", r { clearStringBuffer_gen(log) },
 | 
| 23 |       "Copy to new window", r { scrollAllTheWayDown(maximizeFrame(showText_fast_noWrap("System Log", log))) });
 | 
| 24 | } | 
| 25 | |
| 26 |   void update {
 | 
| 27 | JFastLogView_noWrap _view = view; | 
| 28 | if (_view == null) ret; | 
| 29 | Long changes = cast getOpt(log, 'changes); | 
| 30 |     if (changes == null || neq(changes, changesSeen)) {
 | 
| 31 | if (changes != null) changesSeen = changes; | 
| 32 | _view.setText(extractLastNLinesOfString(linesToShow, str(log))); | 
| 33 | scrollAllTheWayDown(_view); | 
| 34 | } | 
| 35 | } | 
| 36 | } | 
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: | 576 / 3115 | 
| Version history: | 8 change(s) | 
| Referenced in: | [show references] |