-
Notifications
You must be signed in to change notification settings - Fork 528
Open
Description
In JSG isolate setup, we only install a logging handler if an inspector is attached or we're running in --verbose mode. This makes jsg::Lock::logWarning() only go to those sinks, and not tail Workers, which differs from IoContext::logWarning()'s behavior.
Relatedly, errors reported via jsg::Lock::reportError() are clearly intended to go to tail workers if they are installed, but we only install an error handler callback when an inspector is attached:
workerd/src/workerd/io/worker.c++
Lines 1126 to 1137 in 37dc327
| if (impl->inspector != kj::none || ::kj::_::Debug::shouldLog(::kj::LogSeverity::INFO)) { | |
| lock->setLoggerCallback([this](jsg::Lock& js, kj::StringPtr message) { | |
| if (impl->inspector != kj::none) { | |
| logMessage(js, static_cast<uint16_t>(cdp::LogType::WARNING), message); | |
| } | |
| KJ_LOG(INFO, "console warning", message); | |
| }); | |
| lock->setErrorReporterCallback([this](jsg::Lock& js, kj::String desc, | |
| const jsg::JsValue& error, const jsg::JsMessage& message) { | |
| // Only add exception to trace when running within an I/O context with a tracer. | |
| KJ_IF_SOME(ioContext, IoContext::tryCurrent()) { | |
| KJ_IF_SOME(tracer, ioContext.getWorkerTracer()) { |
Originally posted by @harrishancock in #6070 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels