From 4a2e8c73c42ae7f193734cf62d1ef3258118bfb4 Mon Sep 17 00:00:00 2001 From: Jonathan Sick Date: Fri, 30 Apr 2021 11:47:24 -0400 Subject: [PATCH] Eliminate client-side console.log The only logging we'll now do on start up is to confirm the paths of configuration files. --- components/page.js | 2 -- hooks/currentUrl.js | 2 -- next.config.js | 11 ++--------- pages/api/dev/user-info.js | 1 - pages/login.js | 4 +--- pages/logout.js | 4 +--- 6 files changed, 4 insertions(+), 20 deletions(-) diff --git a/components/page.js b/components/page.js index 105b49d4..fdd3afad 100644 --- a/components/page.js +++ b/components/page.js @@ -33,8 +33,6 @@ const StyledLayout = styled.div` * content, and footer. */ export default function Page({ children, loginData }) { - console.log(loginData); - return ( diff --git a/hooks/currentUrl.js b/hooks/currentUrl.js index ff97a47e..fdc50c3b 100644 --- a/hooks/currentUrl.js +++ b/hooks/currentUrl.js @@ -7,8 +7,6 @@ const { publicRuntimeConfig } = getConfig(); export const useCurrentUrl = () => { const { baseUrl } = publicRuntimeConfig; - console.log(`useCurrentUrl getConfig baseUrl ${baseUrl}`); const router = useRouter(); - return new URL(router.pathname, baseUrl); }; diff --git a/next.config.js b/next.config.js index b193763b..3e62ecf7 100644 --- a/next.config.js +++ b/next.config.js @@ -27,10 +27,8 @@ const readYamlConfig = (configPath, schemaPath) => { const readPublicYamlConfig = () => { const p = process.env.SQUAREONE_CONFIG_PATH || 'squareone.config.yaml'; const configPath = path.isAbsolute(p) ? p : path.join(process.cwd(), p); - console.log(`Public config path: ${configPath}`); - + console.log(`Reading public squareone config from ${configPath}`); const schemaPath = path.join(__dirname, 'squareone.config.schema.json'); - const data = readYamlConfig(configPath, schemaPath); return data; }; @@ -38,17 +36,13 @@ const readPublicYamlConfig = () => { const readServerYamlConfig = () => { const p = process.env.SQUAREONE_CONFIG_PATH || 'squareone.serverconfig.yaml'; const configPath = path.isAbsolute(p) ? p : path.join(process.cwd(), p); - console.log(`Server config path: ${configPath}`); - + console.log(`Reading server-side squareone config from ${configPath}`); const schemaPath = path.join(__dirname, 'squareone.serverconfig.schema.json'); - const data = readYamlConfig(configPath, schemaPath); return data; }; module.exports = (phase, { defaultConfig }) => { - console.log(`Read config in ${phase}`); - const publicYamlConfig = readPublicYamlConfig(); const serverYamlConfig = readServerYamlConfig(); @@ -65,6 +59,5 @@ module.exports = (phase, { defaultConfig }) => { ]; }, }; - console.log(config); return config; }; diff --git a/pages/api/dev/user-info.js b/pages/api/dev/user-info.js index 5fc2898d..442ad011 100644 --- a/pages/api/dev/user-info.js +++ b/pages/api/dev/user-info.js @@ -3,7 +3,6 @@ import { getDevState } from '../../../devstate'; export default function handler(req, res) { - console.log('user-info'); const { loggedIn, username, name, uid } = getDevState(); if (!loggedIn) { res.status(401).end('Not logged in'); diff --git a/pages/login.js b/pages/login.js index 998c6f8b..fab87a23 100644 --- a/pages/login.js +++ b/pages/login.js @@ -22,9 +22,7 @@ export default function Login({ baseUrl }) { method: 'POST', body, headers: { 'Content-Type': 'application/json' }, - }) - .then((response) => console.log(response)) - .then(sleep(100).then(() => window.location.assign('/'))); + }).then(sleep(100).then(() => window.location.assign('/'))); }; return ( diff --git a/pages/logout.js b/pages/logout.js index 3822e97c..29ee9df0 100644 --- a/pages/logout.js +++ b/pages/logout.js @@ -14,9 +14,7 @@ export default function Logout({ baseUrl }) { event.preventDefault(); fetch(getDevLogoutEndpoint(currentUrl), { method: 'POST', - }) - .then((response) => console.log(response)) - .then(sleep(100).then(() => window.location.assign('/'))); + }).then(sleep(100).then(() => window.location.assign('/'))); }; return (