MCPcopy Create free account
hub / github.com/arctic-cli/interface / build

Function build

packages/arctic/src/util/log.ts:109–126  ·  view source on GitHub ↗
(message: any, extra?: Record<string, any>)

Source from the content-addressed store, hash-verified

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")) {

Callers 4

debugFunction · 0.85
infoFunction · 0.85
errorFunction · 0.85
warnFunction · 0.85

Calls 1

formatErrorFunction · 0.70

Tested by

no test coverage detected