mirror of
https://github.com/gchq/CyberChef.git
synced 2025-06-17 03:35:07 -04:00
Reviewed Input and Output Waiters and improved logging in workers
This commit is contained in:
parent
56d1a016da
commit
91f1be8c70
12 changed files with 204 additions and 111 deletions
|
@ -7,11 +7,17 @@
|
|||
*/
|
||||
|
||||
import Dish from "../../core/Dish.mjs";
|
||||
import loglevelMessagePrefix from "loglevel-message-prefix";
|
||||
|
||||
loglevelMessagePrefix(log, {
|
||||
prefixes: [],
|
||||
staticPrefixes: ["DishWorker"]
|
||||
});
|
||||
|
||||
self.addEventListener("message", function(e) {
|
||||
// Handle message from the main thread
|
||||
const r = e.data;
|
||||
log.debug(`DishWorker receiving command '${r.action}'`);
|
||||
log.debug(`Receiving command '${r.action}'`);
|
||||
|
||||
switch (r.action) {
|
||||
case "getDishAs":
|
||||
|
@ -20,8 +26,11 @@ self.addEventListener("message", function(e) {
|
|||
case "getDishTitle":
|
||||
getDishTitle(r.data);
|
||||
break;
|
||||
case "setLogLevel":
|
||||
log.setLevel(r.data, false);
|
||||
break;
|
||||
default:
|
||||
log.error(`DishWorker sent invalid action: '${r.action}'`);
|
||||
log.error(`Unknown action: '${r.action}'`);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue