mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
feat: better logs
- added ability to write debug logs for development builds - added filtering to log page - modified filter button to allow for multiple selection if required
This commit is contained in:
@@ -265,7 +265,7 @@ export const useSettings = () => {
|
||||
if (!api) return;
|
||||
const settings = await api.getStreamyfinPluginConfig().then(
|
||||
({ data }) => {
|
||||
writeInfoLog(`Got remote settings: ${data?.settings}`);
|
||||
writeInfoLog("Got plugin settings", data?.settings);
|
||||
return data?.settings;
|
||||
},
|
||||
(err) => undefined,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type React from "react";
|
||||
import { createContext, useContext } from "react";
|
||||
import { storage } from "./mmkv";
|
||||
|
||||
type LogLevel = "INFO" | "WARN" | "ERROR";
|
||||
export type LogLevel = "INFO" | "WARN" | "ERROR" | "DEBUG";
|
||||
|
||||
interface LogEntry {
|
||||
timestamp: string;
|
||||
@@ -62,6 +62,11 @@ export const writeInfoLog = (message: string, data?: any) =>
|
||||
writeToLog("INFO", message, data);
|
||||
export const writeErrorLog = (message: string, data?: any) =>
|
||||
writeToLog("ERROR", message, data);
|
||||
export const writeDebugLog = (message: string, data?: any) => {
|
||||
if (process.env.DEBUG === "1") {
|
||||
writeToLog("DEBUG", message, data);
|
||||
}
|
||||
}
|
||||
|
||||
export const readFromLog = (): LogEntry[] => {
|
||||
const logs = storage.getString("logs");
|
||||
|
||||
Reference in New Issue
Block a user