Logging
Edit the default logging behavior
Stagehand logs log a LogLine
object. You can override the default logger by passing in a custom logger function to the constructor.
Below is the list of fields in the LogLine
object. message
is the main log message content, and auxiliary
contains parameters that can be used to provide additional context and color to the log.
Unique identifier for the log line
Category/type of the log message
The main log message content
Logging verbosity level
Timestamp of when the log was created
Additional metadata where each key contains a value
and type
. The value
will always be a string, but type
can be "object"
, "string"
, "html"
, "integer"
, "float"
, or "boolean"
You can see an example of a log line in OpenAIClient.ts
. You’ll notice here how auxiliary
contains a requestId
and cachedResponse
.