Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-29462 ECL Watch fix display of HTML entities in log messages #17566

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions esp/src/src-react/hooks/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import toast from "react-hot-toast";
import { isExceptions } from "@hpcc-js/comms";
import { Dispatch, Level, logger as utilLogger, scopedLogger, Writer, CallbackFunction, Message } from "@hpcc-js/util";
import { CustomToaster } from "../components/controls/CustomToaster";
import * as Utility from "src/Utility";

const logger = scopedLogger("../util/logging.ts");

Expand Down Expand Up @@ -69,13 +70,16 @@ export class ECLWatchLogger implements Writer {
rawWrite(dateTime: string, level: Level, id: string, _msg: string | object): void {
if (isExceptions(_msg)) {
_msg.Exception?.forEach(ex => {
this.doWrite(dateTime, level, id, `${ex.Code}: ${ex.Message}`);
const msg = Utility.decodeHTML(ex.Message);
this.doWrite(dateTime, level, id, `${ex.Code}: ${msg}`);
});
} else if (_msg instanceof Error) {
this.doWrite(dateTime, level, id, _msg.message);
} else if (typeof _msg !== "string") {
this.doWrite(dateTime, level, id, JSON.stringify(_msg, undefined, 2));
} else if (typeof _msg === "string") {
} else {
if (_msg instanceof Error) {
_msg = _msg.message;
} else if (typeof _msg !== "string") {
_msg = JSON.stringify(_msg, undefined, 2);
}
_msg = Utility.decodeHTML(_msg);
this.doWrite(dateTime, level, id, _msg);
}
}
Expand Down
Loading