mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 08:50:56 +01:00
* feat(logs): improve logs by logging errors with causes and metadata * fix: deepsource issue
9 lines
458 B
TypeScript
9 lines
458 B
TypeScript
export const formatMetadata = (metadata: Record<string, unknown> | Error, ignoreKeys?: string[]) => {
|
|
const filteredMetadata = Object.keys(metadata)
|
|
.filter((key) => !ignoreKeys?.includes(key))
|
|
.map((key) => ({ key, value: metadata[key as keyof typeof metadata] }))
|
|
.filter(({ value }) => typeof value !== "object" && typeof value !== "function");
|
|
|
|
return filteredMetadata.map(({ key, value }) => `${key}="${value as string}"`).join(" ");
|
|
};
|