@typed-assistant/builder 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/setupWebserver.tsx +3 -1
- package/src/webserver/Logs.tsx +3 -3
package/package.json
CHANGED
package/src/setupWebserver.tsx
CHANGED
|
@@ -138,6 +138,7 @@ export const startWebappServer = async ({
|
|
|
138
138
|
}),
|
|
139
139
|
response: t.Object({ logs: t.Array(t.String()) }),
|
|
140
140
|
async open(ws) {
|
|
141
|
+
console.log("😅😅😅 ~ ws.data.query.limit:", ws.data.query.limit)
|
|
141
142
|
ws.send(await getLogsFromFile(ws.data.query.limit))
|
|
142
143
|
logSubscribers.set(ws.id, async () => {
|
|
143
144
|
ws.send(await getLogsFromFile(ws.data.query.limit))
|
|
@@ -225,10 +226,11 @@ export const startWebappServer = async ({
|
|
|
225
226
|
export type WebServer = Awaited<ReturnType<typeof startWebappServer>>
|
|
226
227
|
|
|
227
228
|
const getLogsFromFile = async (limit?: string) => {
|
|
229
|
+
console.log("😅😅😅 ~ limit:", limit)
|
|
228
230
|
try {
|
|
229
231
|
const lines = (await Bun.file("./log.txt").text()).split("\n")
|
|
230
232
|
const logFile = limit
|
|
231
|
-
? lines.slice(lines.length - Number(limit), lines.length - 1)
|
|
233
|
+
? lines.slice(lines.length - 1 - Number(limit), lines.length - 1)
|
|
232
234
|
: lines
|
|
233
235
|
return { logs: logFile }
|
|
234
236
|
} catch (e) {
|
package/src/webserver/Logs.tsx
CHANGED
|
@@ -18,7 +18,7 @@ const LogSchema = z.object({
|
|
|
18
18
|
type LogSchema = z.infer<typeof LogSchema>
|
|
19
19
|
|
|
20
20
|
export const Logs = () => {
|
|
21
|
-
const [limit, setLimit] = useState(
|
|
21
|
+
const [limit, setLimit] = useState(200)
|
|
22
22
|
const [level, setLevel] = useState<
|
|
23
23
|
"trace" | "debug" | "info" | "warn" | "error" | "fatal"
|
|
24
24
|
>("trace")
|
|
@@ -82,7 +82,7 @@ export const Logs = () => {
|
|
|
82
82
|
<option value="fatal">Fatal</option>
|
|
83
83
|
</select>
|
|
84
84
|
</div>
|
|
85
|
-
<div className="flex gap-2">
|
|
85
|
+
{/* <div className="flex gap-2">
|
|
86
86
|
<label htmlFor="limit">Limit</label>
|
|
87
87
|
<input
|
|
88
88
|
className="border border-gray-300 rounded-md text-slate-800 px-2"
|
|
@@ -91,7 +91,7 @@ export const Logs = () => {
|
|
|
91
91
|
size={8}
|
|
92
92
|
value={limit}
|
|
93
93
|
/>
|
|
94
|
-
</div>
|
|
94
|
+
</div> */}
|
|
95
95
|
</div>
|
|
96
96
|
</>
|
|
97
97
|
)}
|