Skip to content

Commit 413bd11

Browse files
committed
refactor: silence logs for release
1 parent b9328a2 commit 413bd11

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

packages/nuxt/src/runtime/admin/plugin-auth-user.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
1616
const token = getCookie(event, AUTH_COOKIE_NAME)
1717
let user: UserRecord | undefined
1818

19-
log(`Getting user from "${AUTH_COOKIE_NAME}"`, token)
19+
// log('debug', `Getting user from "${AUTH_COOKIE_NAME}"`, token)
2020

2121
if (token) {
2222
const adminApp = nuxtApp.$firebaseAdminApp as AdminApp
@@ -32,7 +32,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
3232
if (isFirebaseError(err) && err.code === 'auth/id-token-expired') {
3333
// Other errors to be handled: auth/argument-error
3434
// the error is fine, the user is not logged in
35-
log('Token expired -', err)
35+
log('info', 'Token expired -', err)
3636
} else {
3737
// ignore the error and consider the user as not logged in
3838
log('error', 'Unknown Error -', err)

packages/nuxt/src/runtime/app/plugin.server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ export default defineNuxtPlugin((nuxtApp) => {
3434

3535
let firebaseApp: FirebaseApp
3636

37-
log('initializing app with', appConfig.firebaseConfig)
37+
// log('debug', 'initializing app with', appConfig.firebaseConfig)
3838
if (uid) {
3939
if (!appCache.has(uid)) {
4040
const randomId = Math.random().toString(36).slice(2)
4141
const appName = `auth:${user.uid}:${randomId}`
4242

43-
log('✅ creating new app', appName)
43+
// log('debug', '✅ creating new app', appName)
4444

4545
appCache.set(uid, initializeApp(appConfig.firebaseConfig, appName))
4646
}
4747
firebaseApp = appCache.get(uid)!
4848
} else {
4949
// anonymous session, just create a new app
50-
log('anonymous session')
50+
// log('debug', 'anonymous session')
5151
firebaseApp = initializeApp(appConfig.firebaseConfig)
5252
}
5353

packages/nuxt/src/runtime/auth/api.session-verification.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export default defineEventHandler(async (event) => {
1818
assertMethod(event, 'POST')
1919
const { token } = await readBody(event)
2020

21-
log('minting a session cookie')
21+
// log('debug', 'minting a session cookie')
2222
const adminApp = getApp()
2323
const adminAuth = getAdminAuth(adminApp)
2424

25-
log('read idToken from Authorization header', token)
25+
// log('debug', 'read idToken from Authorization header', token)
2626
const verifiedIdToken = token ? await adminAuth.verifyIdToken(token) : null
2727

2828
if (verifiedIdToken) {
@@ -39,7 +39,7 @@ export default defineEventHandler(async (event) => {
3939
log('error', 'Error minting the cookie -', e.message)
4040
})
4141
if (cookie) {
42-
log('minted a session cookie', cookie)
42+
// log('debug', 'minted a session cookie', cookie)
4343
setCookie(event, AUTH_COOKIE_NAME, cookie, {
4444
maxAge: AUTH_COOKIE_MAX_AGE,
4545
secure: true,
@@ -50,13 +50,13 @@ export default defineEventHandler(async (event) => {
5050
event.node.res.statusCode = 201
5151
return ''
5252
} else {
53-
log('failed to mint a session cookie')
53+
log('error', 'failed to mint a session cookie')
5454
event.node.res.statusCode = 401
5555
return ''
5656
}
5757
}
5858
} else {
59-
log('deleting the session cookie')
59+
log('debug', 'deleting the session cookie')
6060
deleteCookie(event, AUTH_COOKIE_NAME)
6161
event.node.res.statusCode = 204
6262
}

packages/nuxt/src/runtime/auth/plugin.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineNuxtPlugin((nuxtApp) => {
1515
UserSymbol as unknown as string
1616
] as User | undefined | null
1717

18-
log('debug', 'setting up user for app', firebaseApp.name, user?.uid)
18+
// log('debug', 'setting up user for app', firebaseApp.name, user?.uid)
1919

2020
// provide the user data to the app during ssr
2121
VueFireAuthServer(firebaseApp, nuxtApp.vueApp, user)

0 commit comments

Comments
 (0)