(message: any, extra?: Record<string, any>)
| 107 | } |
| 108 | |
| 109 | function build(message: any, extra?: Record<string, any>) { |
| 110 | const prefix = Object.entries({ |
| 111 | ...tags, |
| 112 | ...extra, |
| 113 | }) |
| 114 | .filter(([_, value]) => value !== undefined && value !== null) |
| 115 | .map(([key, value]) => { |
| 116 | const prefix = `${key}=` |
| 117 | if (value instanceof Error) return prefix + formatError(value) |
| 118 | if (typeof value === "object") return prefix + JSON.stringify(value) |
| 119 | return prefix + value |
| 120 | }) |
| 121 | .join(" ") |
| 122 | const next = new Date() |
| 123 | const diff = next.getTime() - last |
| 124 | last = next.getTime() |
| 125 | return [next.toISOString().split(".")[0], "+" + diff + "ms", prefix, message].filter(Boolean).join(" ") + "\n" |
| 126 | } |
| 127 | const result: Logger = { |
| 128 | debug(message?: any, extra?: Record<string, any>) { |
| 129 | if (shouldLog("DEBUG")) { |
no test coverage detected