feat(#27): Set up consola logger, make use of log levels in backend and frontend
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { useLogger } from './useLogger'
|
||||
|
||||
export const isServerAvailable = ref(true)
|
||||
export const isChecking = ref(false)
|
||||
export const lastCheckTime = ref<Date | null>(null)
|
||||
|
||||
export function useServerHealth() {
|
||||
const logger = useLogger().withTag('serverHealth')
|
||||
const checkInterval = ref<ReturnType<typeof setInterval> | null>(null)
|
||||
const healthCheckUrl = '/api/actuator/health'
|
||||
|
||||
@@ -30,11 +33,11 @@ export function useServerHealth() {
|
||||
isServerAvailable.value = response.ok
|
||||
|
||||
if (!wasAvailable && isServerAvailable.value) {
|
||||
console.info('Server is back online')
|
||||
logger.info('Server is back online')
|
||||
}
|
||||
|
||||
if (wasAvailable && !isServerAvailable.value) {
|
||||
console.warn('Server is no longer available')
|
||||
logger.warn('Server is no longer available')
|
||||
}
|
||||
|
||||
return isServerAvailable.value
|
||||
@@ -43,7 +46,7 @@ export function useServerHealth() {
|
||||
isServerAvailable.value = false
|
||||
|
||||
if (wasAvailable) {
|
||||
console.warn('Server health check failed:', error)
|
||||
logger.warn('Server health check failed:', error)
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user