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

40
LINES

< > BotCompany Repo | #1019633 // VM Bus Snooper - disabled, needs rewrite

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

Uses 1113K of libraries. Click here for Pure Java version (6632L/32K).

!7

// TODO: This is still super easy to crash
// as it tries to record every internal VM bus message
// for things like threads and locks. We need a different
// approach here - just collect in a list!?

cmodule2 VMBusSnooper > DynPrintLog {
  switchable bool enabled;
  switchable bool logToDisk;
  switchable bool showStackTraces;
  switchable S filter = ""; // regular expression
  
  start {
    q(); // make sure to create queue because creating it
         // while handling a VM bus message is really bad
    /*dm_vmBus_onAnyMessage(voidfunc(fS msg, fO _arg) {
      if (!enabled || empty(filter)) ret;
      Throwable stackTrace = showStackTraces ? new Throwable : null;
      switch to q();
      O arg = _arg;
      if (!regexpFindIC(filter, msg)) ret;
      if (arg instanceof O[]) arg = joinWithComma(allToString((O[]) arg));
      S s = msg + (arg == null ? "" : " | " + arg);
      print(localTimeWithSeconds() + " " + shorten(s, 200));
      if (logToDisk)
        programLog(shorten(s, 1024));
      if (stackTrace != null)
        printStackTrace(stackTrace);
    });*/
  }
  
  visual centerAndSouthWithMargins(super,
    centerAndEastWithMargin(dm_fieldWithLabel filter(),
      jline(
        dm_fieldCheckBox logToDisk(),
        dm_fieldCheckBox showStackTraces(),
        dm_fieldCheckBox enabled())))
;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1019633
Snippet name: VM Bus Snooper - disabled, needs rewrite
Eternal ID of this version: #1019633/24
Text MD5: 8900efc833e29ad5a31bca39a12f2d84
Transpilation MD5: 890e1695c75219e541ac7c7150690af3
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: 2021-06-29 21:26:54
Source code size: 1368 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 252 / 4989
Version history: 23 change(s)
Referenced in: [show references]