2020-04-17 09:02:21 -04:00
|
|
|
<template>
|
2020-04-27 10:07:28 -04:00
|
|
|
<div>
|
2020-04-17 09:02:21 -04:00
|
|
|
<Menu />
|
2023-01-11 04:54:25 -05:00
|
|
|
<div class="date-container">
|
|
|
|
<div class="date-div">
|
|
|
|
<input type="date" class="form-control" v-model="listDate" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="log-container mt-2">
|
|
|
|
<div class="log-content" v-html="formatLog(currentLog)" />
|
|
|
|
</div>
|
2020-04-17 09:02:21 -04:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { useAuth } from '~/stores/auth'
|
|
|
|
import { useConfig } from '~/stores/config'
|
|
|
|
|
|
|
|
definePageMeta({
|
|
|
|
middleware: ['auth'],
|
|
|
|
})
|
|
|
|
|
|
|
|
useHead({
|
|
|
|
title: 'Logging | ffplayout'
|
|
|
|
})
|
|
|
|
|
2023-01-11 07:41:22 -05:00
|
|
|
onMounted(() => {
|
|
|
|
getLog()
|
|
|
|
})
|
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
const { $dayjs } = useNuxtApp()
|
|
|
|
const authStore = useAuth()
|
|
|
|
const configStore = useConfig()
|
|
|
|
const currentLog = ref('')
|
|
|
|
const listDate = ref($dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD'))
|
|
|
|
const { formatLog } = stringFormatter()
|
|
|
|
|
2023-01-11 07:41:22 -05:00
|
|
|
watch([listDate, configStore.configID], () => {
|
|
|
|
getLog()
|
|
|
|
})
|
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
async function getLog() {
|
|
|
|
let date = listDate.value
|
|
|
|
|
|
|
|
if (date === $dayjs().utcOffset(configStore.utcOffset).format('YYYY-MM-DD')) {
|
|
|
|
date = ''
|
2020-04-17 09:02:21 -04:00
|
|
|
}
|
2023-01-11 04:54:25 -05:00
|
|
|
|
2023-01-11 07:41:22 -05:00
|
|
|
await fetch(`/api/log/${configStore.configGui[configStore.configID].id}?date=${date}`, {
|
2023-01-11 04:54:25 -05:00
|
|
|
method: 'GET',
|
|
|
|
headers: authStore.authHeader,
|
|
|
|
})
|
|
|
|
.then((response) => response.text())
|
|
|
|
.then((data) => {
|
|
|
|
currentLog.value = data
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
currentLog.value = ''
|
|
|
|
})
|
2020-04-17 09:02:21 -04:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
<style lang="scss">
|
|
|
|
.date-container {
|
|
|
|
width: 100%;
|
|
|
|
height: 37px;
|
2021-01-28 11:19:00 -05:00
|
|
|
}
|
2020-04-27 10:07:28 -04:00
|
|
|
.log-container {
|
2023-01-11 04:54:25 -05:00
|
|
|
background: $bg-secondary;
|
|
|
|
height: calc(100% - 120px);
|
|
|
|
margin: 1em;
|
|
|
|
padding: .5em;
|
|
|
|
overflow: hidden;
|
2020-04-27 10:07:28 -04:00
|
|
|
}
|
|
|
|
|
2022-05-15 15:53:02 -04:00
|
|
|
.log-time {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-time;
|
2022-05-15 15:53:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-number {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-number;
|
2022-05-15 15:53:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-addr {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-addr ;
|
2022-05-15 15:53:02 -04:00
|
|
|
font-weight: 500;
|
|
|
|
}
|
|
|
|
|
|
|
|
.log-cmd {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-cmd;
|
2022-05-15 15:53:02 -04:00
|
|
|
}
|
|
|
|
|
2020-04-27 10:07:28 -04:00
|
|
|
.log-content {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-content;
|
2021-01-28 11:19:00 -05:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
font-family: monospace;
|
|
|
|
font-size: 13px;
|
|
|
|
white-space: pre;
|
2022-09-07 11:05:47 -04:00
|
|
|
overflow: scroll;
|
|
|
|
scrollbar-width: medium;
|
2020-04-27 10:07:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-info {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-info;
|
2020-04-27 10:07:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-warning {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-warning;
|
2020-04-27 10:07:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-error {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-error;
|
2020-04-27 10:07:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-debug {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-debug;
|
2020-04-27 10:07:28 -04:00
|
|
|
}
|
|
|
|
|
2022-01-25 04:32:29 -05:00
|
|
|
.log-decoder {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-decoder;
|
2022-01-25 04:32:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-encoder {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-encoder;
|
2022-01-25 04:32:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.log-server {
|
2023-01-11 04:54:25 -05:00
|
|
|
color: $log-server;
|
2022-01-25 04:32:29 -05:00
|
|
|
}
|
2020-04-17 09:02:21 -04:00
|
|
|
</style>
|