Skip to content

Logger

A custom logging handler you can provide when connecting to SketchUp.

By default the API logs to console, but you can pass your own Logger implementation as the second argument to SketchUpApi.connect() to route messages elsewhere — for example, sending errors to a crash-reporting service while silencing debug output in production.

Each method mirrors the standard console API, receiving a message string and optional additional arguments.

// A minimal logger that only shows errors
let quietLogger = {
error: (msg, ...args) =>
console.error('[JSA]', msg, ...args),
warn: () => {},
info: () => {},
debug: () => {},
log: () => {},
};
await SketchUpApi.connect({}, quietLogger);

debug(message, …args): void

Parameter Type

message

string

…args

unknown[]

void


error(message, …args): void

Parameter Type

message

string

…args

unknown[]

void


info(message, …args): void

Parameter Type

message

string

…args

unknown[]

void


log(message, …args): void

Parameter Type

message

string

…args

unknown[]

void


warn(message, …args): void

Parameter Type

message

string

…args

unknown[]

void