π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web] Enhance log.debug
Manav Rathi882137251506
diff --git a/web/packages/new/photos/services/ml/embedding.ts b/web/packages/new/photos/services/ml/embedding.tsindex 5c07b9e375..eadeb00b0e 100644--- a/web/packages/new/photos/services/ml/embedding.ts+++ b/web/packages/new/photos/services/ml/embedding.ts@@ -267,7 +267,7 @@ export const putEmbedding = async (model: EmbeddingModel,embedding: string,) => {- log.debug(() => ({ t: `Uploading embedding`, model, embedding }));+ log.debug(() => ["Uploading embedding", { model, embedding }]);const { encryptedMetadataB64, decryptionHeaderB64 } =await encryptFileMetadata(embedding, enteFile.key);diff --git a/web/packages/next/log.ts b/web/packages/next/log.tsindex 1e86f7f17f..ee3b84f066 100644--- a/web/packages/next/log.ts+++ b/web/packages/next/log.ts@@ -87,7 +87,23 @@ const logInfo = (...params: unknown[]) => {};const logDebug = (param: () => unknown) => {- if (isDevBuild) console.log("[debug]", param());+ if (isDevBuild) {+ const p = param();+ // Transform+ // log.debug(() => ["tag", {x: y}])+ // =>+ // console.log("[debug] tag", {x: y})+ if (Array.isArray(p)) {+ // tseslint is not happy with us for destructuring any, but this is+ // non-production dev build only code, so silence it and go ahead.+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment+ const [tag, ...rest] = p;+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument+ console.log(`[debug] ${tag}`, ...rest);+ } else { /* Let console.log serialize it */+ console.log("[debug]", p);+ }+ }};/**@@ -139,7 +155,9 @@ export default {* message. The provided function will only be called in development builds.** The function can return an arbitrary value which is serialized before- * being logged.+ * being logged. As a special case, arrays are spread, which allows one to+ * write `log.debug(() => ["tag", {x: y}])` and have that be printed as if+ * it were `console.log("[debug] tag", {x: y})`.** This log is NOT written to disk. It is printed to the browser console,* but only in development builds.