Skip to content

Commit

Permalink
feat: ip label in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso committed Dec 11, 2024
1 parent 80bc57a commit 26b721e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/store/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { LOG_LEVEL } from '@/config'
import type { Log, LogWithSeq } from '@/types'
import { useStorage } from '@vueuse/core'
import { ref, watch } from 'vue'
import { sourceIPLabelMap } from './settings'

export const logs = ref<LogWithSeq[]>([])
export const logFilter = ref('')
Expand All @@ -27,6 +28,13 @@ export const initLogs = () => {
return
}

for (const ip in sourceIPLabelMap.value) {
if (data.payload.includes(ip)) {
data.payload = data.payload.replace(ip, `${ip}(${sourceIPLabelMap.value[ip]})`)
break
}
}

logs.value.unshift({
...data,
time: new Date().valueOf(),
Expand Down

0 comments on commit 26b721e

Please sign in to comment.