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

21
LINES

< > BotCompany Repo | #1029816 - Print Snooper [filter stuff printed by other modules]

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

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

!7

// Note: Modules to be snooped on must have been retranspiled
// after Sep 2020 so they send "printed" VM bus messages
cmodule PrintSnooper > DynPrintLog {
  switchable bool enabled;
  switchable S filter = ""; // regular expression
  
  start {
    dm_vmBus_onMessage printed(voidfunc(O where, S text) {
      if (!enabled) ret;
      switch to q();
      if (!regexpFindIC(filter, text)) ret;
      print(localTimeWithSeconds() + " " + shorten(escapeNewLines(text), 200));
    });
  }
  
  visual centerAndSouthWithMargins(super,
    centerAndEastWithMargin(dm_fieldWithLabel filter(),
      dm_fieldCheckBox enabled()));
}

Author comment

Began life as a copy of #1019633

download  show line numbers  debug dex   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, tvejysmllsmz

No comments. add comment

Snippet ID: #1029816
Snippet name: Print Snooper [filter stuff printed by other modules]
Eternal ID of this version: #1029816/2
Text MD5: 6766bdc06c59e02878ae00fcef6812c7
Transpilation MD5: dd6a8a211f80e1c3d82fa8c0c1cc60e7
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-23 10:33:59
Source code size: 649 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 33 / 2914
Version history: 1 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1029816 & http://1029816.tinybrain.de