MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / outputChannelLog

Method outputChannelLog

src/extension/api.ts:441–470  ·  view source on GitHub ↗
(...args: unknown[])

Source from the content-addressed store, hash-verified

439 // Logging
440
441 private outputChannelLog(...args: unknown[]) {
442 for (const arg of args) {
443 if (arg === null) {
444 this.outputChannel.appendLine("null")
445 } else if (arg === undefined) {
446 this.outputChannel.appendLine("undefined")
447 } else if (typeof arg === "string") {
448 this.outputChannel.appendLine(arg)
449 } else if (arg instanceof Error) {
450 this.outputChannel.appendLine(`Error: ${arg.message}\n${arg.stack || ""}`)
451 } else {
452 try {
453 this.outputChannel.appendLine(
454 JSON.stringify(
455 arg,
456 (key, value) => {
457 if (typeof value === "bigint") return `BigInt(${value})`
458 if (typeof value === "function") return `Function: ${value.name || "anonymous"}`
459 if (typeof value === "symbol") return value.toString()
460 return value
461 },
462 2,
463 ),
464 )
465 } catch (error) {
466 this.outputChannel.appendLine(`[Non-serializable object: ${Object.prototype.toString.call(arg)}]`)
467 }
468 }
469 }
470 }
471
472 private async fileLog(message: string) {
473 if (!this.logfile) {

Callers 1

constructorMethod · 0.95

Calls 2

appendLineMethod · 0.80
toStringMethod · 0.65

Tested by

no test coverage detected