feat(#27): Set up consola logger, make use of log levels in backend and frontend

This commit is contained in:
2025-12-24 10:26:22 +01:00
parent 805c66bc4f
commit 7f7852a66a
36 changed files with 312 additions and 141 deletions

View File

@@ -1,6 +1,7 @@
import type { CreateCommentDto, CommentDto } from '~~/.api-client'
import { useCommentStore } from '~~/stores/useCommentStore'
import { useUserStore } from '~~/stores/useUserStore'
import { useLogger } from '../useLogger'
export function useCommentTextarea(applicationFormId: string) {
const commentStore = useCommentStore()
@@ -11,6 +12,8 @@ export function useCommentTextarea(applicationFormId: string) {
const currentEditedComment = ref<CommentDto | null>(null)
const commentTextAreaValue = ref('')
const toast = useToast()
const { t: $t } = useI18n()
const logger = useLogger().withTag('commentTextarea')
async function submitComment(formElementId: string) {
const newCommentDto: CreateCommentDto = {
@@ -19,10 +22,10 @@ export function useCommentTextarea(applicationFormId: string) {
try {
await createComment(applicationFormId, formElementId, newCommentDto)
commentTextAreaValue.value = ''
toast.add({ title: 'Comment created successfully', color: 'success' })
toast.add({ title: $t('comments.created'), color: 'success' })
} catch (e) {
toast.add({ title: 'Error creating comment', color: 'error' })
console.error('Error creating comment:', e)
toast.add({ title: $t('comments.createError'), color: 'error' })
logger.error('Error creating comment:', e)
}
}
@@ -34,10 +37,10 @@ export function useCommentTextarea(applicationFormId: string) {
commentTextAreaValue.value = ''
currentEditedComment.value = null
isEditingComment.value = false
toast.add({ title: 'Comment updated successfully', color: 'success' })
toast.add({ title: $t('comments.updated'), color: 'success' })
} catch (e) {
toast.add({ title: 'Error updating comment', color: 'error' })
console.error('Error updating comment:', e)
toast.add({ title: $t('comments.updateError'), color: 'error' })
logger.error('Error updating comment:', e)
}
}