chore: get rid of debug logs on prod

This commit is contained in:
Michael H.
2026-08-27 13:44:29 +02:00
parent b68a199814
commit e0cd019869
20 changed files with 65 additions and 37 deletions
@@ -143,6 +143,7 @@ import {
Input,
NewModal,
Textarea,
useDebugLogger,
useVIntl,
} from '@modrinth/ui'
import { computed, defineAsyncComponent, h } from 'vue'
@@ -163,6 +164,7 @@ interface ShowOptions {
const { addNotification } = injectNotificationManager()
const { formatMessage } = useVIntl()
const router = useRouter()
const debug = useDebugLogger('ProjectCreateModal')
defineExpose({
show,
@@ -453,7 +455,7 @@ async function createProject() {
},
})) as Labrinth.Projects.v3.Project
createdProjectId = result.id
console.log(createdProjectId)
debug(createdProjectId)
}
modal.value?.hide()
@@ -516,7 +516,7 @@ const selectedRewardOption = computed(() => {
})
const selectedMethodDetails = computed(() => {
console.log(rewardOptions.value, selectedGiftCardId.value)
debug(rewardOptions.value, selectedGiftCardId.value)
if (!selectedGiftCardId.value) return null
const option = rewardOptions.value.find((opt) => opt.value === selectedGiftCardId.value)
debug('Selected method details:', option?.methodDetails)
@@ -1105,7 +1105,7 @@ if (!persistedState) {
if (thread.value === undefined) return
if (currentStage.value === initialAutoStage) {
const firstValid = findFirstValidStage()
console.log('[DEBUG settle]', {
debug('settle', {
initialAutoStage,
currentStage: currentStage.value,
firstValid,
@@ -1118,7 +1118,7 @@ if (!persistedState) {
markStageVisited(currentStageObj.value.id)
}
} else {
console.log('[DEBUG settle] currentStage already changed before settle', {
debug('settle: currentStage already changed before settle', {
initialAutoStage,
currentStage: currentStage.value,
})
@@ -1143,7 +1143,7 @@ const projectUrlType = computed(() =>
let lastSyncedStageTarget: string | null = null
function syncStageUrl(stage: StageNode | undefined) {
const navigate = stage?._navigate
console.log('[DEBUG syncStageUrl]', { stageId: stage?.id, navigate, lastSyncedStageTarget })
debug('syncStageUrl', { stageId: stage?.id, navigate, lastSyncedStageTarget })
if (navigate === undefined) return
const target = `/${projectUrlType.value}/${projectV2.value.slug}${navigate}`
if (target === lastSyncedStageTarget) return
@@ -42,10 +42,13 @@
</template>
<script setup>
import { useDebugLogger } from '@modrinth/ui'
import * as THREE from 'three'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
import { onMounted, onUnmounted, ref } from 'vue'
const debug = useDebugLogger('Globe')
const container = ref(null)
const showLabels = ref(false)
@@ -87,7 +90,7 @@ const isLocationVisible = (location) => {
}
const toggleLocationClicked = (location) => {
console.log('clicked', location.name)
debug('clicked', location.name)
locations.value.find((loc) => loc.name === location.name).clicked = !location.clicked
}
+3 -1
View File
@@ -644,6 +644,7 @@ import {
ModrinthServersPurchaseModal,
OptionGroup,
TagIcon,
useDebugLogger,
useFormatPrice,
useVIntl,
} from '@modrinth/ui'
@@ -658,6 +659,7 @@ import { products } from '~/generated/state.json'
const route = useRoute()
const router = useRouter()
const client = injectModrinthClient()
const debug = useDebugLogger('Hosting')
const { setAffiliateCode, getAffiliateCode } = useAffiliates()
@@ -1199,7 +1201,7 @@ const selectProduct = async (product) => {
}
await refreshCapacity()
console.log(capacityStatuses.value)
debug(capacityStatuses.value)
if ((product === 'custom' && isCustomAtCapacity.value) || isAtCapacity.value) {
addNotification({
@@ -227,6 +227,7 @@ import {
type MultiSelectItem,
Pagination,
TeleportPopoutMenu,
useDebugLogger,
useVIntl,
} from '@modrinth/ui'
import Fuse from 'fuse.js'
@@ -241,6 +242,7 @@ const route = useRoute()
const router = useRouter()
const auth = await useAuth()
const client = injectModrinthClient()
const debug = useDebugLogger('ModerationReports')
const { data: allReports } = await useLazyAsyncData('new-moderation-reports', async () => {
const startTime = performance.now()
@@ -284,7 +286,7 @@ const { data: allReports } = await useLazyAsyncData('new-moderation-reports', as
const endTime = performance.now()
const duration = endTime - startTime
console.debug(
debug(
`Reports fetched and processed in ${duration.toFixed(2)}ms (${(duration / 1000).toFixed(2)}s)`,
)
@@ -711,6 +711,7 @@ import {
ResubscribeModal,
ServerListing,
TeleportOverflowMenu,
useDebugLogger,
useFormatDateTime,
useFormatPrice,
useServerBackupDownload,
@@ -728,6 +729,7 @@ import { products } from '~/generated/state.json'
const { addNotification, handleError } = injectNotificationManager()
const client = injectModrinthClient()
const { getLatestBackupDownload } = useServerBackupDownload()
const debug = useDebugLogger('Billing')
definePageMeta({
middleware: 'auth',
})
@@ -1013,7 +1015,6 @@ const messages = defineMessages({
})
function getIntervalNounLabel(interval) {
console.log(interval)
return interval === 'yearly'
? formatMessage(messages.intervalYear)
: interval === 'quarterly'
@@ -1391,10 +1392,10 @@ function showCancellationSurvey(subscription) {
price: price ? `${price / 100}` : 'unknown',
currency: currency ?? 'unknown',
},
onOpen: () => console.log(`Opened cancellation survey for: ${subscription.id}`),
onClose: () => console.log(`Closed cancellation survey for: ${subscription.id}`),
onOpen: () => debug(`Opened cancellation survey for: ${subscription.id}`),
onClose: () => debug(`Closed cancellation survey for: ${subscription.id}`),
onSubmit: (payload) => {
console.log('Form submitted, cancelling server.', payload)
debug('Form submitted, cancelling server.', payload)
cancelSubscription(subscription.id, true)
},
}
@@ -1403,9 +1404,7 @@ function showCancellationSurvey(subscription) {
try {
if (window.Tally?.openPopup) {
console.log(
`Opening Tally popup for servers subscription ${subscription.id} (form ID: ${formId})`,
)
debug(`Opening Tally popup for servers subscription ${subscription.id} (form ID: ${formId})`)
window.Tally.openPopup(formId, popupOptions)
} else {
console.warn('Tally script not yet loaded')