0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-26 05:05:23 +00:00

add logger

This commit is contained in:
Kenny 2022-02-28 10:24:06 -05:00
parent 95cf04a66c
commit 368252c603
3 changed files with 54 additions and 6 deletions

View file

@ -88,7 +88,8 @@
],
dropdownMenu: [
{ title: "Settings", link: "/settings" },
{ title: "About", link: "/about" }
{ title: "About", link: "/about" },
{ title: "Logs", link: "/logs" }
]
}),
mounted() {

33
NUXT/pages/logs.vue Normal file
View file

@ -0,0 +1,33 @@
<template>
<div>
<v-list-item v-for="(item, index) in logs" :key="index">
<v-card class="card">
<v-card-title v-text="`${item.name} - ${new Date(item.time).toLocaleString()}`" />
<v-card-text v-text="item.data" />
</v-card>
</v-list-item>
</div>
</template>
<style scoped>
.card {
width: 100%;
margin-top: 1em;
}
</style>
<script>
export default {
data() {
return {
logs: new Array()
}
},
mounted() {
const logs = this.$youtube.logs
this.logs = logs;
}
}
</script>

View file

@ -1,18 +1,32 @@
//--- Modules/Imports ---//
import { Http } from '@capacitor-community/http';
const module = {
async autoComplete(text, callback) {
//--- Logger Function ---//
function logger(func, data) {
module.logs.push({
name: func,
time: Date.now(),
data: data
})
}
const response = await Http.request({
const module = {
logs: new Array(),
//--- Get YouTube's Search Auto Complete ---//
async autoComplete(text, callback) {
const res = await Http.request({
method: 'GET',
url: 'https://suggestqueries-clients6.youtube.com/complete/search',
params: { client: 'youtube', q: text }
});
callback(response)
logger("autoComplete", res);
callback(res);
}
}
//--- Start ---//
export default ({ app }, inject) => {
inject('youtube', module)
}
logger("Initialize","Program Started");