Revert remove hass debug connection in dev (#23356)

This commit is contained in:
Paul Bottein 2024-12-20 14:05:33 +01:00 committed by GitHub
parent ecc704e6ac
commit c532a9023a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
notifyOnError = true, notifyOnError = true,
returnResponse = false returnResponse = false
) => { ) => {
if (this.hass?.debugConnection) { if (__DEV__ || this.hass?.debugConnection) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log( console.log(
"Calling service", "Calling service",
@ -115,7 +115,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
) { ) {
return { context: { id: "" } }; return { context: { id: "" } };
} }
if (this.hass?.debugConnection) { if (__DEV__ || this.hass?.debugConnection) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error( console.error(
"Error calling service", "Error calling service",
@ -167,7 +167,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
) => fetchWithAuth(auth, `${auth.data.hassUrl}${path}`, init), ) => fetchWithAuth(auth, `${auth.data.hassUrl}${path}`, init),
// For messages that do not get a response // For messages that do not get a response
sendWS: (msg) => { sendWS: (msg) => {
if (this.hass?.debugConnection) { if (__DEV__ || this.hass?.debugConnection) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log("Sending", msg); console.log("Sending", msg);
} }
@ -175,14 +175,14 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
}, },
// For messages that expect a response // For messages that expect a response
callWS: <R>(msg) => { callWS: <R>(msg) => {
if (this.hass?.debugConnection) { if (__DEV__ || this.hass?.debugConnection) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log("Sending", msg); console.log("Sending", msg);
} }
const resp = conn.sendMessagePromise<R>(msg); const resp = conn.sendMessagePromise<R>(msg);
if (this.hass?.debugConnection) { if (__DEV__ || this.hass?.debugConnection) {
resp.then( resp.then(
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
(result) => console.log("Received", result), (result) => console.log("Received", result),