Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Synchronize startup banners

Manav Rathi18e47b3d4ec2
diff --git a/desktop/src/main/init.ts b/desktop/src/main/init.ts
index 0e94232aa1..22cdabf08f 100644
--- a/desktop/src/main/init.ts
+++ b/desktop/src/main/init.ts
@@ -149,15 +149,20 @@ export async function handleDockIconHideOnAutoLaunch() {
}
}
-export function logStartupBanner() {
+/**
+ * Log a standard startup banner.
+ *
+ * This helps us identify app starts and other environment details in the logs.
+ */
+export const logStartupBanner = () => {
const version = isDev ? "dev" : app.getVersion();
- log.info(`Hello from ente-photos-desktop ${version}`);
+ log.info(`Starting ente-photos-desktop ${version}`);
const platform = process.platform;
const osRelease = os.release();
const systemVersion = process.getSystemVersion();
log.info("Running on", { platform, osRelease, systemVersion });
-}
+};
function lowerCaseHeaders(responseHeaders: Record<string, string[]>) {
const headers: Record<string, string[]> = {};
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 9de048ec88..457358050e 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -18,7 +18,7 @@ import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
import { useLocalState } from "@ente/shared/hooks/useLocalState";
import {
clearLogsIfLocalStorageLimitExceeded,
- logStartupMessage,
+ logStartupBanner,
} from "@ente/shared/logging/web";
import HTTPService from "@ente/shared/network/HTTPService";
import { LS_KEYS } from "@ente/shared/storage/localStorage";
@@ -75,7 +75,7 @@ export default function App({ Component, pageProps }: AppProps) {
});
// setup logging
clearLogsIfLocalStorageLimitExceeded();
- logStartupMessage(APPS.AUTH);
+ logStartupBanner(APPS.AUTH);
}, []);
const setUserOnline = () => setOffline(false);
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index d03f34273d..b8b289c11d 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -28,7 +28,7 @@ import { useLocalState } from "@ente/shared/hooks/useLocalState";
import { addLogLine } from "@ente/shared/logging";
import {
clearLogsIfLocalStorageLimitExceeded,
- logStartupMessage,
+ logStartupBanner,
} from "@ente/shared/logging/web";
import HTTPService from "@ente/shared/network/HTTPService";
import { logError } from "@ente/shared/sentry";
@@ -157,7 +157,7 @@ export default function App({ Component, pageProps }: AppProps) {
});
// setup logging
clearLogsIfLocalStorageLimitExceeded();
- logStartupMessage(APPS.PHOTOS);
+ logStartupBanner(APPS.PHOTOS);
}, []);
useEffect(() => {
diff --git a/web/packages/shared/logging/web.ts b/web/packages/shared/logging/web.ts
index 45127121b4..69e00533e1 100644
--- a/web/packages/shared/logging/web.ts
+++ b/web/packages/shared/logging/web.ts
@@ -70,14 +70,21 @@ export const clearLogsIfLocalStorageLimitExceeded = () => {
}
};
-export const logStartupMessage = async (appId: string) => {
+/**
+ * Log a standard startup banner.
+ *
+ * This helps us identify app starts and other environment details in the logs.
+ *
+ * @param appId An identifier of the app that is starting.
+ */
+export const logStartupBanner = async (appId: string) => {
// TODO (MR): Remove the need to lowercase it, change the enum itself.
const appIdL = appId.toLowerCase();
const userID = (getData(LS_KEYS.USER) as User)?.id;
const sha = process.env.GIT_SHA;
const buildId = isDevBuild ? "dev " : sha ? `git ${sha} ` : "";
- addLogLine(`ente-${appIdL}-web ${buildId}uid ${userID}`);
+ addLogLine(`Starting ente-${appIdL}-web ${buildId}uid ${userID}`);
};
function getLogs(): Log[] {